Lines 354-360
$borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
Link Here
|
354 |
ok( $borrower->{userid}, 'A userid should have been generated correctly' ); |
354 |
ok( $borrower->{userid}, 'A userid should have been generated correctly' ); |
355 |
|
355 |
|
356 |
subtest 'purgeSelfRegistration' => sub { |
356 |
subtest 'purgeSelfRegistration' => sub { |
357 |
plan tests => 2; |
357 |
plan tests => 5; |
358 |
|
358 |
|
359 |
#purge unverified |
359 |
#purge unverified |
360 |
my $d=360; |
360 |
my $d=360; |
Lines 370-377
subtest 'purgeSelfRegistration' => sub {
Link Here
|
370 |
t::lib::Mocks::mock_preference('PatronSelfRegistrationDefaultCategory', $c ); |
370 |
t::lib::Mocks::mock_preference('PatronSelfRegistrationDefaultCategory', $c ); |
371 |
t::lib::Mocks::mock_preference('PatronSelfRegistrationExpireTemporaryAccountsDelay', 360); |
371 |
t::lib::Mocks::mock_preference('PatronSelfRegistrationExpireTemporaryAccountsDelay', 360); |
372 |
C4::Members::DeleteExpiredOpacRegistrations(); |
372 |
C4::Members::DeleteExpiredOpacRegistrations(); |
373 |
$dbh->do("INSERT INTO borrowers (surname, address, city, branchcode, categorycode, dateenrolled) VALUES ('Testaabbcc', 'Street 1', 'CITY', ?, '$c', '2014-01-01 01:02:03')", undef, $library1->{branchcode}); |
373 |
my $self_reg = $builder->build_object({ |
374 |
is( C4::Members::DeleteExpiredOpacRegistrations(), 1, 'Test for DeleteExpiredOpacRegistrations'); |
374 |
class => 'Koha::Patrons', |
|
|
375 |
value => { |
376 |
dateenrolled => '2014-01-01 01:02:03', |
377 |
categorycode => $c |
378 |
} |
379 |
}); |
380 |
|
381 |
my $checkout = $builder->build_object({ |
382 |
class=>'Koha::Checkouts', |
383 |
value=>{ |
384 |
borrowernumber=>$self_reg->borrowernumber |
385 |
} |
386 |
}); |
387 |
is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with checkout"); |
388 |
|
389 |
my $account_line = $builder->build_object({ |
390 |
class=>'Koha::Account::Lines', |
391 |
value=>{ |
392 |
borrowernumber=>$self_reg->borrowernumber, |
393 |
amountoutstanding=>5 |
394 |
} |
395 |
}); |
396 |
is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with checkout and fine"); |
397 |
|
398 |
$checkout->delete; |
399 |
is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with fine and no checkout"); |
400 |
|
401 |
$account_line->delete; |
402 |
is( C4::Members::DeleteExpiredOpacRegistrations(), 1, "DeleteExpiredOpacRegistrations does delete borrower with no fines and no checkouts"); |
403 |
|
375 |
}; |
404 |
}; |
376 |
|
405 |
|
377 |
sub _find_member { |
406 |
sub _find_member { |
378 |
- |
|
|