Bug 29570: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomas Cohen Arazi 2022-02-02 16:29:00 -03:00 committed by Fridolin Somers
parent 1f746a585e
commit 696bd24dfe
1 changed files with 25 additions and 1 deletions

View File

@ -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;
};