Lines 487-499
subtest 'checkouts + get_overdues' => sub {
Link Here
|
487 |
}; |
487 |
}; |
488 |
|
488 |
|
489 |
subtest 'get_age' => sub { |
489 |
subtest 'get_age' => sub { |
490 |
plan tests => 6; |
490 |
plan tests => 7; |
491 |
|
491 |
|
492 |
my $patron = $builder->build( { source => 'Borrower' } ); |
492 |
my $patron = $builder->build( { source => 'Borrower' } ); |
493 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
493 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
494 |
|
494 |
|
495 |
my $today = dt_from_string; |
495 |
my $today = dt_from_string; |
496 |
|
496 |
|
|
|
497 |
$patron->dateofbirth( undef ); |
498 |
is( $patron->get_age, undef, 'get_age should return undef if no dateofbirth is defined' ); |
497 |
$patron->dateofbirth( $today->clone->add( years => -12, months => -6, days => -1 ) ); |
499 |
$patron->dateofbirth( $today->clone->add( years => -12, months => -6, days => -1 ) ); |
498 |
is( $patron->get_age, 12, 'Patron should be 12' ); |
500 |
is( $patron->get_age, 12, 'Patron should be 12' ); |
499 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 1 ) ); |
501 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 1 ) ); |
500 |
- |
|
|