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