Lines 528-544
subtest 'get_age' => sub {
Link Here
|
528 |
|
528 |
|
529 |
$patron->dateofbirth( undef ); |
529 |
$patron->dateofbirth( undef ); |
530 |
is( $patron->get_age, undef, 'get_age should return undef if no dateofbirth is defined' ); |
530 |
is( $patron->get_age, undef, 'get_age should return undef if no dateofbirth is defined' ); |
531 |
$patron->dateofbirth( $today->clone->add( years => -12, months => -6, days => -1 ) ); |
531 |
$patron->dateofbirth( $today->clone->add( years => -12, months => -6, days => -1, end_of_month => 'limit' ) ); |
532 |
is( $patron->get_age, 12, 'Patron should be 12' ); |
532 |
is( $patron->get_age, 12, 'Patron should be 12' ); |
533 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 1 ) ); |
533 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 1, end_of_month => 'limit' ) ); |
534 |
is( $patron->get_age, 17, 'Patron should be 17, happy birthday tomorrow!' ); |
534 |
is( $patron->get_age, 17, 'Patron should be 17, happy birthday tomorrow!' ); |
535 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 0 ) ); |
535 |
$patron->dateofbirth( $today->clone->add( years => -18, months => 0, days => 0, end_of_month => 'limit' ) ); |
536 |
is( $patron->get_age, 18, 'Patron should be 18' ); |
536 |
is( $patron->get_age, 18, 'Patron should be 18' ); |
537 |
$patron->dateofbirth( $today->clone->add( years => -18, months => -12, days => -31 ) ); |
537 |
$patron->dateofbirth( $today->clone->add( years => -18, months => -12, days => -31, end_of_month => 'limit' ) ); |
538 |
is( $patron->get_age, 19, 'Patron should be 19' ); |
538 |
is( $patron->get_age, 19, 'Patron should be 19' ); |
539 |
$patron->dateofbirth( $today->clone->add( years => -18, months => -12, days => -30 ) ); |
539 |
$patron->dateofbirth( $today->clone->add( years => -18, months => -12, days => -30, end_of_month => 'limit' ) ); |
540 |
is( $patron->get_age, 19, 'Patron should be 19 again' ); |
540 |
is( $patron->get_age, 19, 'Patron should be 19 again' ); |
541 |
$patron->dateofbirth( $today->clone->add( years => 0, months => -1, days => -1 ) ); |
541 |
$patron->dateofbirth( $today->clone->add( years => 0, months => -1, days => -1, end_of_month => 'limit' ) ); |
542 |
is( $patron->get_age, 0, 'Patron is a newborn child' ); |
542 |
is( $patron->get_age, 0, 'Patron is a newborn child' ); |
543 |
|
543 |
|
544 |
$patron->delete; |
544 |
$patron->delete; |
545 |
- |
|
|