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

(-)a/t/db_dependent/Members.t (-2 / +32 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::NoWarnings;
20
use Test::NoWarnings;
21
use Test::More tests => 51;
21
use Test::More tests => 53;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Exception;
23
use Test::Exception;
24
24
Lines 28-33 use Koha::Database; Link Here
28
use Koha::Holds;
28
use Koha::Holds;
29
use Koha::List::Patron qw( AddPatronList AddPatronsToList );
29
use Koha::List::Patron qw( AddPatronList AddPatronsToList );
30
use Koha::Patrons;
30
use Koha::Patrons;
31
use Koha::Patron::Debarments qw( AddDebarment );
31
use Koha::Patron::Relationship;
32
use Koha::Patron::Relationship;
32
33
33
use t::lib::Mocks;
34
use t::lib::Mocks;
Lines 359-364 $patstodel = Link Here
359
    GetBorrowersToExpunge( { not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
360
    GetBorrowersToExpunge( { not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
360
is( scalar(@$patstodel), 2, 'Borrowers without issues deleted by last issue date' );
361
is( scalar(@$patstodel), 2, 'Borrowers without issues deleted by last issue date' );
361
362
363
# Test the "without_restriction_types" parameter of GetBorrowersToExpunge().
364
my $borrower3 = $builder->build(
365
    {
366
        source => 'Borrower',
367
        value  => { categorycode => 'CIVILIAN', flags => undef }
368
    }
369
);
370
my $list2 = AddPatronList( { name => 'Test List 2', owner => $owner } );
371
AddPatronsToList( { list => $list2, borrowernumbers => [ $borrower3->{borrowernumber} ] } );
372
$patstodel = GetBorrowersToExpunge(
373
    {
374
        without_restriction_types => 'MANUAL',
375
        patron_list_id            => $list2->patron_list_id()
376
    }
377
);
378
is( scalar(@$patstodel), 1, 'Borrower without restriction deleted' );
379
Koha::Patron::Debarments::AddDebarment(
380
    {
381
        borrowernumber => $borrower3->{borrowernumber},
382
        type           => 'MANUAL'
383
    }
384
);
385
$patstodel = GetBorrowersToExpunge(
386
    {
387
        without_restriction_types => 'MANUAL',
388
        patron_list_id            => $list2->patron_list_id()
389
    }
390
);
391
is( scalar(@$patstodel), 0, 'Borrower with restriction not deleted' );
392
362
# Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers
393
# Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers
363
my $new_category = $builder->build_object(
394
my $new_category = $builder->build_object(
364
    {
395
    {
365
- 

Return to bug 37418