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