|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 13; |
22 |
use Test::More tests => 14; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use DateTime; |
24 |
use DateTime; |
| 25 |
|
25 |
|
|
Lines 169-174
subtest 'update_password' => sub {
Link Here
|
| 169 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
169 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
| 170 |
}; |
170 |
}; |
| 171 |
|
171 |
|
|
|
172 |
subtest 'is_expired' => sub { |
| 173 |
plan tests => 5; |
| 174 |
my $patron = $builder->build({ source => 'Borrower' }); |
| 175 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 176 |
$patron->dateexpiry( undef )->store; |
| 177 |
is( $patron->is_expired, 0, 'Patron should not be considered expired if dateexpiry is not set'); |
| 178 |
$patron->dateexpiry( '0000-00-00' )->store; |
| 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; |
| 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; |
| 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; |
| 185 |
is( $patron->is_expired, 1, 'Patron should be considered expired if dateexpiry is yesterday'); |
| 186 |
|
| 187 |
$patron->delete; |
| 188 |
}; |
| 189 |
|
| 172 |
subtest 'renew_account' => sub { |
190 |
subtest 'renew_account' => sub { |
| 173 |
plan tests => 10; |
191 |
plan tests => 10; |
| 174 |
my $a_month_ago = dt_from_string->add( months => -1 )->truncate( to => 'day' ); |
192 |
my $a_month_ago = dt_from_string->add( months => -1 )->truncate( to => 'day' ); |
| 175 |
- |
|
|