Lines 621-627
subtest 'objects.search helper, search_limited() tests' => sub {
Link Here
|
621 |
}; |
621 |
}; |
622 |
|
622 |
|
623 |
subtest 'objects.find helper with expanded authorised values' => sub { |
623 |
subtest 'objects.find helper with expanded authorised values' => sub { |
624 |
plan tests => 10; |
624 |
plan tests => 14; |
625 |
|
625 |
|
626 |
$schema->storage->txn_begin; |
626 |
$schema->storage->txn_begin; |
627 |
|
627 |
|
Lines 708-713
subtest 'objects.find helper with expanded authorised values' => sub {
Link Here
|
708 |
->json_has('/_authorised_values') |
708 |
->json_has('/_authorised_values') |
709 |
->json_is( '/_authorised_values/country/lib' => $ar->lib ); |
709 |
->json_is( '/_authorised_values/country/lib' => $ar->lib ); |
710 |
|
710 |
|
|
|
711 |
$t->get_ok( '/cities/' . $manuel->cityid => { 'x-koha-av-expand' => 0 } ) |
712 |
->status_is(200)->json_is( '/name' => 'Manuel' ) |
713 |
->json_hasnt('/_authorised_values'); |
714 |
|
711 |
$t->get_ok( '/cities/' . $manuela->cityid => { 'x-koha-av-expand' => 1 } ) |
715 |
$t->get_ok( '/cities/' . $manuela->cityid => { 'x-koha-av-expand' => 1 } ) |
712 |
->status_is(200)->json_is( '/name' => 'Manuela' ) |
716 |
->status_is(200)->json_is( '/name' => 'Manuela' ) |
713 |
->json_has('/_authorised_values') |
717 |
->json_has('/_authorised_values') |
Lines 718-724
subtest 'objects.find helper with expanded authorised values' => sub {
Link Here
|
718 |
|
722 |
|
719 |
subtest 'objects.search helper with expanded authorised values' => sub { |
723 |
subtest 'objects.search helper with expanded authorised values' => sub { |
720 |
|
724 |
|
721 |
plan tests => 11; |
725 |
plan tests => 20; |
722 |
|
726 |
|
723 |
my $t = Test::Mojo->new; |
727 |
my $t = Test::Mojo->new; |
724 |
|
728 |
|
Lines 801-812
subtest 'objects.search helper with expanded authorised values' => sub {
Link Here
|
801 |
); |
805 |
); |
802 |
|
806 |
|
803 |
$t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' => |
807 |
$t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' => |
804 |
{ 'x-koha-av-expand' => 1 } )->status_is(200)->json_has('/0') |
808 |
{ 'x-koha-av-expand' => 1 } )->status_is(200) |
805 |
->json_has('/1')->json_hasnt('/2')->json_is( '/0/name' => 'Manuel' ) |
809 |
->json_has('/0')->json_has('/1')->json_hasnt('/2') |
|
|
810 |
->json_is( '/0/name' => 'Manuel' ) |
806 |
->json_has('/0/_authorised_values') |
811 |
->json_has('/0/_authorised_values') |
807 |
->json_is( '/0/_authorised_values/country/lib' => $ar->lib ) |
812 |
->json_is( '/0/_authorised_values/country/lib' => $ar->lib ) |
808 |
->json_is( '/1/name' => 'Manuela' )->json_has('/1/_authorised_values') |
813 |
->json_is( '/1/name' => 'Manuela' ) |
|
|
814 |
->json_has('/1/_authorised_values') |
809 |
->json_is( '/1/_authorised_values/country/lib' => $us->lib ); |
815 |
->json_is( '/1/_authorised_values/country/lib' => $us->lib ); |
810 |
|
816 |
|
|
|
817 |
$t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' => |
818 |
{ 'x-koha-av-expand' => 0 } )->status_is(200) |
819 |
->json_has('/0')->json_has('/1')->json_hasnt('/2') |
820 |
->json_is( '/0/name' => 'Manuel' )->json_hasnt('/0/_authorised_values') |
821 |
->json_is( '/1/name' => 'Manuela' )->json_hasnt('/1/_authorised_values'); |
822 |
|
823 |
|
811 |
$schema->storage->txn_rollback; |
824 |
$schema->storage->txn_rollback; |
812 |
}; |
825 |
}; |
813 |
- |
|
|