Lines 455-469
subtest 'new_from_api() tests' => sub {
Link Here
|
455 |
|
455 |
|
456 |
subtest 'attributes_from_api() tests' => sub { |
456 |
subtest 'attributes_from_api() tests' => sub { |
457 |
|
457 |
|
458 |
plan tests => 8; |
458 |
plan tests => 12; |
459 |
|
459 |
|
460 |
my $patron = Koha::Patron->new(); |
460 |
my $patron = Koha::Patron->new(); |
461 |
|
461 |
|
462 |
use Data::Printer colored => 1; |
|
|
463 |
|
464 |
my $attrs = $patron->attributes_from_api( |
462 |
my $attrs = $patron->attributes_from_api( |
465 |
{ |
463 |
{ |
466 |
updated_on => '2019-12-27T14:53:00' |
464 |
updated_on => '2019-12-27T14:53:00', |
467 |
} |
465 |
} |
468 |
); |
466 |
); |
469 |
|
467 |
|
Lines 519-524
subtest 'attributes_from_api() tests' => sub {
Link Here
|
519 |
'date_of_birth', |
517 |
'date_of_birth', |
520 |
'Exception parameter is the API field name, not the DB one' |
518 |
'Exception parameter is the API field name, not the DB one' |
521 |
); |
519 |
); |
|
|
520 |
|
521 |
# Booleans |
522 |
$attrs = $patron->attributes_from_api( |
523 |
{ |
524 |
incorrect_address => Mojo::JSON->true, |
525 |
patron_card_lost => Mojo::JSON->false, |
526 |
} |
527 |
); |
528 |
|
529 |
ok( exists $attrs->{gonenoaddress}, 'Attribute gets translated' ); |
530 |
is( $attrs->{gonenoaddress}, 1, 'Boolean correctly translated to integer (true => 1)' ); |
531 |
ok( exists $attrs->{lost}, 'Attribute gets translated' ); |
532 |
is( $attrs->{lost}, 0, 'Boolean correctly translated to integer (false => 0)' ); |
522 |
}; |
533 |
}; |
523 |
|
534 |
|
524 |
subtest "Test update method" => sub { |
535 |
subtest "Test update method" => sub { |
525 |
- |
|
|