Bug 30677: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit de4fcc91f0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2022-05-06 13:53:01 +02:00 committed by Lucas Gass
parent 245cd510ab
commit 9fa5cf04ae
1 changed files with 8 additions and 2 deletions

View File

@ -38,7 +38,7 @@ my $t = Test::Mojo->new('Koha::REST::V1');
subtest 'list() tests' => sub {
plan tests => 19;
plan tests => 24;
$schema->storage->txn_begin;
@ -111,12 +111,18 @@ subtest 'list() tests' => sub {
};
my $query = { "biblio.isbn" => { "-like" => "\%SOMETHING\%" } };
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?q=" . encode_json($query) => {'x-koha-embed' => 'biblio'} )
->status_is( 200, "Embedding biblio and searching on biblio.isbn doesn't make it explode" )
->json_has( "/0/biblio", "biblio object correctly embedded" )
->json_is( "/0/biblio/isbn", 'SOMETHING', 'Filtering by a biblioitems column works!' );
$query = { "biblio.isbn" => { "-like" => "\%SOMETHING\%" }, "biblio.title" => { -like => "\%\%" } };
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?q=" . encode_json($query) => {'x-koha-embed' => 'biblio'} )
->status_is( 200, "Embedding biblio and searching on biblio.isbn and biblio.title doesn't make it explode" )
->json_has( "/0/biblio", "biblio object correctly embedded" )
->json_is( "/0/biblio/isbn", 'SOMETHING', 'Filtering by a biblioitem column works!' )
->json_is( "/0/biblio/title", $biblio->title, 'Filtering by a biblioitem and biblio columns works!' );
my $result = $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?biblio_id=" . $biblio->biblionumber )
->status_is( 200 );