Lines 186-198
subtest 'update_password' => sub {
Link Here
|
186 |
}; |
186 |
}; |
187 |
|
187 |
|
188 |
subtest 'is_expired' => sub { |
188 |
subtest 'is_expired' => sub { |
189 |
plan tests => 5; |
189 |
plan tests => 4; |
190 |
my $patron = $builder->build({ source => 'Borrower' }); |
190 |
my $patron = $builder->build({ source => 'Borrower' }); |
191 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
191 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
192 |
$patron->dateexpiry( undef )->store->discard_changes; |
192 |
$patron->dateexpiry( undef )->store->discard_changes; |
193 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not set'); |
193 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not set'); |
194 |
$patron->dateexpiry( '0000-00-00' ); |
|
|
195 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is 0000-00-00'); |
196 |
$patron->dateexpiry( dt_from_string )->store->discard_changes; |
194 |
$patron->dateexpiry( dt_from_string )->store->discard_changes; |
197 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is today'); |
195 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is today'); |
198 |
$patron->dateexpiry( dt_from_string->add( days => 1 ) )->store->discard_changes; |
196 |
$patron->dateexpiry( dt_from_string->add( days => 1 ) )->store->discard_changes; |
Lines 204-216
subtest 'is_expired' => sub {
Link Here
|
204 |
}; |
202 |
}; |
205 |
|
203 |
|
206 |
subtest 'is_going_to_expire' => sub { |
204 |
subtest 'is_going_to_expire' => sub { |
207 |
plan tests => 9; |
205 |
plan tests => 8; |
208 |
my $patron = $builder->build({ source => 'Borrower' }); |
206 |
my $patron = $builder->build({ source => 'Borrower' }); |
209 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
207 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
210 |
$patron->dateexpiry( undef )->store->discard_changes; |
208 |
$patron->dateexpiry( undef )->store->discard_changes; |
211 |
is( $patron->is_going_to_expire, 0, 'Patron should not be considered going to expire if dateexpiry is not set'); |
209 |
is( $patron->is_going_to_expire, 0, 'Patron should not be considered going to expire if dateexpiry is not set'); |
212 |
$patron->dateexpiry( '0000-00-00' ); |
|
|
213 |
is( $patron->is_going_to_expire, 0, 'Patron should not be considered going to expire if dateexpiry is 0000-00-00'); |
214 |
|
210 |
|
215 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
211 |
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); |
216 |
$patron->dateexpiry( dt_from_string )->store->discard_changes; |
212 |
$patron->dateexpiry( dt_from_string )->store->discard_changes; |
217 |
- |
|
|