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