Lines 169-183
subtest 'is_expired' => sub {
Link Here
|
169 |
plan tests => 5; |
169 |
plan tests => 5; |
170 |
my $patron = $builder->build({ source => 'Borrower' }); |
170 |
my $patron = $builder->build({ source => 'Borrower' }); |
171 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
171 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
172 |
$patron->dateexpiry( undef )->store; |
172 |
$patron->dateexpiry( undef )->store->discard_changes; |
173 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not set'); |
173 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not set'); |
174 |
$patron->dateexpiry( '0000-00-00' )->store; |
174 |
$patron->dateexpiry( '0000-00-00' )->store->discard_changes; |
175 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not 0000-00-00'); |
175 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not 0000-00-00'); |
176 |
$patron->dateexpiry( dt_from_string )->store; |
176 |
$patron->dateexpiry( dt_from_string )->store->discard_changes; |
177 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is today'); |
177 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is today'); |
178 |
$patron->dateexpiry( dt_from_string->add( days => 1 ) )->store; |
178 |
$patron->dateexpiry( dt_from_string->add( days => 1 ) )->store->discard_changes; |
179 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is tomorrow'); |
179 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is tomorrow'); |
180 |
$patron->dateexpiry( dt_from_string->add( days => -1 ) )->store; |
180 |
$patron->dateexpiry( dt_from_string->add( days => -1 ) )->store->discard_changes; |
181 |
is( $patron->is_expired, 1, 'Patron should be considered expired if dateexpiry is yesterday'); |
181 |
is( $patron->is_expired, 1, 'Patron should be considered expired if dateexpiry is yesterday'); |
182 |
|
182 |
|
183 |
$patron->delete; |
183 |
$patron->delete; |
184 |
- |
|
|