From 9be564728367efe758c2e0a21e9b7cef91cb9f41 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 2 Feb 2022 16:29:00 -0300 Subject: [PATCH] Bug 29570: Regression tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: Lucas Gass Signed-off-by: Jonathan Druart --- t/db_dependent/api/v1/acquisitions_orders.t | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/acquisitions_orders.t b/t/db_dependent/api/v1/acquisitions_orders.t index 398f918b970..3025c1856bc 100755 --- a/t/db_dependent/api/v1/acquisitions_orders.t +++ b/t/db_dependent/api/v1/acquisitions_orders.t @@ -137,7 +137,7 @@ subtest 'list() tests' => sub { subtest 'sorting tests' => sub { - plan tests => 10; + plan tests => 14; $schema->storage->txn_begin; @@ -188,6 +188,30 @@ subtest 'list() tests' => sub { is( $result->[0]->{order_id}, $order_2->id, 'The first element is order_2' ); is( $result->[1]->{order_id}, $order_1->id, 'The second element is order_1' ); + $biblio_1->biblioitem->set( + { + isbn => 'A', + ean => 'Y', + publishercode => 'M', + } + )->store; + + $biblio_2->biblioitem->set( + { + isbn => 'B', + ean => 'X', + publishercode => 'L', + } + )->store; + + $result = + $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_order_by=-biblio.isbn,+biblio.ean,-biblio.publisher&basket_id=" . $basket->id => {'x-koha-embed' => 'biblio'} ) + ->status_is( 200, "query successful" ) + ->tx->res->json; + + is( $result->[0]->{order_id}, $order_2->id, 'Ordered correctly' ); + is( $result->[1]->{order_id}, $order_1->id, 'Ordered correctly' ); + $schema->storage->txn_rollback; }; -- 2.25.1