Lines 415-421
subtest 'search_upcoming_membership_expires' => sub {
Link Here
|
415 |
|
415 |
|
416 |
# Test with branch |
416 |
# Test with branch |
417 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} }); |
417 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} }); |
418 |
is( $upcoming_mem_expires->count, 1, ); |
418 |
is( $upcoming_mem_expires->count, 1, 'Test with branch parameter' ); |
419 |
my $expired = $upcoming_mem_expires->next; |
419 |
my $expired = $upcoming_mem_expires->next; |
420 |
is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' ); |
420 |
is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' ); |
421 |
is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' ); |
421 |
is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' ); |
Lines 433-443
subtest 'search_upcoming_membership_expires' => sub {
Link Here
|
433 |
# Test the before parameter |
433 |
# Test the before parameter |
434 |
t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 ); |
434 |
t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 ); |
435 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before }); |
435 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before }); |
436 |
# Expect 29/6 and 30/6 |
436 |
is( $upcoming_mem_expires->count, 2, 'Expect two results for before'); |
437 |
is( $upcoming_mem_expires->count, 2, 'Expect two results for before==1'); |
|
|
438 |
# Test after parameter also |
437 |
# Test after parameter also |
439 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after }); |
438 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after }); |
440 |
# Expect 29/6, 30/6 and 2/7 |
|
|
441 |
is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' ); |
439 |
is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' ); |
442 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
440 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
443 |
}; |
441 |
}; |
444 |
- |
|
|