|
Lines 202-231
subtest 'is_going_to_expired' => sub {
Link Here
|
| 202 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today'); |
202 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today'); |
| 203 |
|
203 |
|
| 204 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
204 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
| 205 |
my $dt_from_string = dt_from_string; |
205 |
$patron->dateexpiry( dt_from_string )->store; |
| 206 |
$patron->dateexpiry( $dt_from_string )->store; |
|
|
| 207 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today and pref is 0'); |
206 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today and pref is 0'); |
| 208 |
|
207 |
|
| 209 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
208 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
| 210 |
$patron->dateexpiry( dt_from_string->add( days => 11 ) )->store; |
209 |
$patron->dateexpiry( dt_from_string->add( days => 11 ) )->store; |
| 211 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 11 days before and pref is 10'); |
210 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 11 days ahead and pref is 10'); |
| 212 |
|
211 |
|
| 213 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
212 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
| 214 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
213 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
| 215 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days before and pref is 0'); |
214 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days ahead and pref is 0'); |
| 216 |
|
215 |
|
| 217 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
216 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
| 218 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
217 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
| 219 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days before and pref is 10'); |
218 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days ahead and pref is 10'); |
| 220 |
$patron->delete; |
219 |
$patron->delete; |
| 221 |
|
220 |
|
| 222 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
221 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); |
| 223 |
$patron->dateexpiry( dt_from_string->add( days => 20 ) )->store; |
222 |
$patron->dateexpiry( dt_from_string->add( days => 20 ) )->store; |
| 224 |
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'); |
223 |
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 20 days ahead and pref is 10'); |
| 225 |
|
224 |
|
| 226 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 20); |
225 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 20); |
| 227 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
226 |
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; |
| 228 |
is( $patron->is_going_to_expired, 1, 'Patron should be considered going to expire if dateexpiry is 10 days before and pref is 20'); |
227 |
is( $patron->is_going_to_expired, 1, 'Patron should be considered going to expire if dateexpiry is 10 days ahead and pref is 20'); |
| 229 |
|
228 |
|
| 230 |
$patron->delete; |
229 |
$patron->delete; |
| 231 |
}; |
230 |
}; |
| 232 |
- |
|
|