Lines 530-537
subtest 'attributes_from_api() tests' => sub {
Link Here
|
530 |
|
530 |
|
531 |
my $attrs = $patron->attributes_from_api( |
531 |
my $attrs = $patron->attributes_from_api( |
532 |
{ |
532 |
{ |
533 |
updated_on => '2019-12-27T14:53:00', |
533 |
updated_on => '2019-12-27T14:53:00Z', |
534 |
last_seen => '2019-12-27T14:53:00', |
534 |
last_seen => '2019-12-27T14:53:00Z', |
535 |
date_of_birth => '2019-12-27', |
535 |
date_of_birth => '2019-12-27', |
536 |
} |
536 |
} |
537 |
); |
537 |
); |
Lines 539-563
subtest 'attributes_from_api() tests' => sub {
Link Here
|
539 |
ok( exists $attrs->{updated_on}, |
539 |
ok( exists $attrs->{updated_on}, |
540 |
'No translation takes place if no mapping' ); |
540 |
'No translation takes place if no mapping' ); |
541 |
is( |
541 |
is( |
542 |
ref( $attrs->{updated_on} ), |
542 |
$attrs->{updated_on}, |
543 |
'DateTime', |
543 |
'2019-12-27 14:53:00', |
544 |
'Given a string, a timestamp field is converted into a DateTime object' |
544 |
'Given an rfc3339 formatted datetime string, a timestamp field is converted into an SQL formatted datetime string' |
545 |
); |
545 |
); |
546 |
|
546 |
|
547 |
ok( exists $attrs->{lastseen}, |
547 |
ok( exists $attrs->{lastseen}, |
548 |
'Translation takes place because of the defined mapping' ); |
548 |
'Translation takes place because of the defined mapping' ); |
549 |
is( |
549 |
is( |
550 |
ref( $attrs->{lastseen} ), |
550 |
$attrs->{lastseen}, |
551 |
'DateTime', |
551 |
'2019-12-27 14:53:00', |
552 |
'Given a string, a datetime field is converted into a DateTime object' |
552 |
'Given an rfc3339 formatted datetime string, a datetime field is converted into an SQL formatted datetime string' |
553 |
); |
553 |
); |
554 |
|
554 |
|
555 |
ok( exists $attrs->{dateofbirth}, |
555 |
ok( exists $attrs->{dateofbirth}, |
556 |
'Translation takes place because of the defined mapping' ); |
556 |
'Translation takes place because of the defined mapping' ); |
557 |
is( |
557 |
is( |
558 |
ref( $attrs->{dateofbirth} ), |
558 |
$attrs->{dateofbirth}, |
559 |
'DateTime', |
559 |
'2019-12-27', |
560 |
'Given a string, a date field is converted into a DateTime object' |
560 |
'Given an rfc3339 formated date string, a date field is converted into an SQL formatted date string' |
561 |
); |
561 |
); |
562 |
|
562 |
|
563 |
$attrs = $patron->attributes_from_api( |
563 |
$attrs = $patron->attributes_from_api( |
564 |
- |
|
|