Lines 569-575
subtest 'search_upcoming_membership_expires' => sub {
Link Here
|
569 |
|
569 |
|
570 |
# Test with branch |
570 |
# Test with branch |
571 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} }); |
571 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} }); |
572 |
is( $upcoming_mem_expires->count, 1, ); |
572 |
is( $upcoming_mem_expires->count, 1, 'Test with branch parameter' ); |
573 |
my $expired = $upcoming_mem_expires->next; |
573 |
my $expired = $upcoming_mem_expires->next; |
574 |
is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' ); |
574 |
is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' ); |
575 |
is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' ); |
575 |
is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' ); |
Lines 587-597
subtest 'search_upcoming_membership_expires' => sub {
Link Here
|
587 |
# Test the before parameter |
587 |
# Test the before parameter |
588 |
t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 ); |
588 |
t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 ); |
589 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before }); |
589 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before }); |
590 |
# Expect 29/6 and 30/6 |
590 |
is( $upcoming_mem_expires->count, 2, 'Expect two results for before'); |
591 |
is( $upcoming_mem_expires->count, 2, 'Expect two results for before==1'); |
|
|
592 |
# Test after parameter also |
591 |
# Test after parameter also |
593 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after }); |
592 |
$upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after }); |
594 |
# Expect 29/6, 30/6 and 2/7 |
|
|
595 |
is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' ); |
593 |
is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' ); |
596 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
594 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
597 |
}; |
595 |
}; |
598 |
- |
|
|