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