|
Lines 188-194
subtest 'is_expired' => sub {
Link Here
|
| 188 |
}; |
188 |
}; |
| 189 |
|
189 |
|
| 190 |
subtest 'is_going_to_expired' => sub { |
190 |
subtest 'is_going_to_expired' => sub { |
| 191 |
plan tests => 8; |
191 |
plan tests => 9; |
| 192 |
my $patron = $builder->build({ source => 'Borrower' }); |
192 |
my $patron = $builder->build({ source => 'Borrower' }); |
| 193 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
193 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 194 |
$patron->dateexpiry( undef )->store; |
194 |
$patron->dateexpiry( undef )->store; |
|
Lines 220-225
subtest 'is_going_to_expired' => sub {
Link Here
|
| 220 |
$patron->dateexpiry( dt_from_string->add( days => 20 ) )->store; |
220 |
$patron->dateexpiry( dt_from_string->add( days => 20 ) )->store; |
| 221 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 20 days before and pref is 10'); |
221 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 20 days before and pref is 10'); |
| 222 |
|
222 |
|
|
|
223 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 20); |
| 224 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
| 225 |
is( $patron->is_going_to_expired, 1, 'Patron should be considered going to expire if dateexpiry is 10 days before and pref is 20'); |
| 226 |
|
| 223 |
$patron->delete; |
227 |
$patron->delete; |
| 224 |
}; |
228 |
}; |
| 225 |
|
229 |
|
| 226 |
- |
|
|