|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 50; |
20 |
use Test::More tests => 52; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Exception; |
22 |
use Test::Exception; |
| 23 |
|
23 |
|
|
Lines 27-32
use Koha::Database;
Link Here
|
| 27 |
use Koha::Holds; |
27 |
use Koha::Holds; |
| 28 |
use Koha::List::Patron qw( AddPatronList AddPatronsToList ); |
28 |
use Koha::List::Patron qw( AddPatronList AddPatronsToList ); |
| 29 |
use Koha::Patrons; |
29 |
use Koha::Patrons; |
|
|
30 |
use Koha::Patron::Debarments qw( AddDebarment ); |
| 30 |
use Koha::Patron::Relationship; |
31 |
use Koha::Patron::Relationship; |
| 31 |
|
32 |
|
| 32 |
use t::lib::Mocks; |
33 |
use t::lib::Mocks; |
|
Lines 280-285
is( scalar(@$patstodel),2,'Borrowers without issues deleted by expiration_date a
Link Here
|
| 280 |
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } ); |
281 |
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } ); |
| 281 |
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); |
282 |
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); |
| 282 |
|
283 |
|
|
|
284 |
# Test the "without_restriction_types" parameter of GetBorrowersToExpunge(). |
| 285 |
my $borrower3 = $builder->build( |
| 286 |
{ |
| 287 |
source => 'Borrower', |
| 288 |
value => { categorycode => 'CIVILIAN', flags => undef } |
| 289 |
} |
| 290 |
); |
| 291 |
my $list2 = AddPatronList( { name => 'Test List 2', owner => $owner } ); |
| 292 |
AddPatronsToList( { list => $list2, borrowernumbers => [ $borrower3->{borrowernumber} ] } ); |
| 293 |
$patstodel = GetBorrowersToExpunge( |
| 294 |
{ |
| 295 |
without_restriction_types => 'MANUAL', |
| 296 |
patron_list_id => $list2->patron_list_id() |
| 297 |
} |
| 298 |
); |
| 299 |
is( scalar(@$patstodel), 1, 'Borrower without restriction deleted' ); |
| 300 |
Koha::Patron::Debarments::AddDebarment( |
| 301 |
{ |
| 302 |
borrowernumber => $borrower3->{borrowernumber}, |
| 303 |
type => 'MANUAL' |
| 304 |
} |
| 305 |
); |
| 306 |
$patstodel = GetBorrowersToExpunge( |
| 307 |
{ |
| 308 |
without_restriction_types => 'MANUAL', |
| 309 |
patron_list_id => $list2->patron_list_id() |
| 310 |
} |
| 311 |
); |
| 312 |
is( scalar(@$patstodel), 0, 'Borrower with restriction not deleted' ); |
| 313 |
|
| 283 |
# Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers |
314 |
# Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers |
| 284 |
my $new_category = $builder->build_object( |
315 |
my $new_category = $builder->build_object( |
| 285 |
{ |
316 |
{ |
| 286 |
- |
|
|