View | Details | Raw Unified | Return to bug 22052
Collapse All | Expand All

(-)a/t/db_dependent/Members.t (-4 / +32 lines)
Lines 337-343 $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; Link Here
337
ok( $borrower->{userid},  'A userid should have been generated correctly' );
337
ok( $borrower->{userid},  'A userid should have been generated correctly' );
338
338
339
subtest 'purgeSelfRegistration' => sub {
339
subtest 'purgeSelfRegistration' => sub {
340
    plan tests => 2;
340
    plan tests => 5;
341
341
342
    #purge unverified
342
    #purge unverified
343
    my $d=360;
343
    my $d=360;
Lines 353-360 subtest 'purgeSelfRegistration' => sub { Link Here
353
    t::lib::Mocks::mock_preference('PatronSelfRegistrationDefaultCategory', $c );
353
    t::lib::Mocks::mock_preference('PatronSelfRegistrationDefaultCategory', $c );
354
    t::lib::Mocks::mock_preference('PatronSelfRegistrationExpireTemporaryAccountsDelay', 360);
354
    t::lib::Mocks::mock_preference('PatronSelfRegistrationExpireTemporaryAccountsDelay', 360);
355
    C4::Members::DeleteExpiredOpacRegistrations();
355
    C4::Members::DeleteExpiredOpacRegistrations();
356
    $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});
356
    my $self_reg = $builder->build_object({
357
    is( C4::Members::DeleteExpiredOpacRegistrations(), 1, 'Test for DeleteExpiredOpacRegistrations');
357
        class => 'Koha::Patrons',
358
        value => {
359
            dateenrolled => '2014-01-01 01:02:03',
360
            categorycode => $c
361
        }
362
    });
363
364
    my $checkout     = $builder->build_object({
365
        class=>'Koha::Checkouts',
366
        value=>{
367
            borrowernumber=>$self_reg->borrowernumber
368
        }
369
    });
370
    is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with checkout");
371
372
    my $account_line = $builder->build_object({
373
        class=>'Koha::Account::Lines',
374
        value=>{
375
            borrowernumber=>$self_reg->borrowernumber,
376
            amountoutstanding=>5
377
        }
378
    });
379
    is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with checkout and fine");
380
381
    $checkout->delete;
382
    is( C4::Members::DeleteExpiredOpacRegistrations(), 0, "DeleteExpiredOpacRegistrations doesn't delete borrower with fine and no checkout");
383
384
    $account_line->delete;
385
    is( C4::Members::DeleteExpiredOpacRegistrations(), 1, "DeleteExpiredOpacRegistrations does delete borrower with no fines and no checkouts");
386
358
};
387
};
359
388
360
sub _find_member {
389
sub _find_member {
361
- 

Return to bug 22052