From c38f4659511f6c4e137ee9196288188ec6341c0d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 28 Oct 2021 09:30:41 -0300 Subject: [PATCH] Bug 28948: Fix random failure This patch makes the query for randomly generated libraries deterministic, thus getting rid of the random tests failures. Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/REST/Plugin/Objects.t | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/REST/Plugin/Objects.t b/t/db_dependent/Koha/REST/Plugin/Objects.t index 47a953a834..9bff09d9c4 100755 --- a/t/db_dependent/Koha/REST/Plugin/Objects.t +++ b/t/db_dependent/Koha/REST/Plugin/Objects.t @@ -89,7 +89,10 @@ get '/libraries/:library_id_1/:library_id_2' => sub { my $library_id_1 = $c->param('library_id_1'); my $library_id_2 = $c->param('library_id_2'); - my $libraries_rs = Koha::Libraries->search({ branchcode => [ $library_id_1, $library_id_2 ] }); + my $libraries_rs = Koha::Libraries->search( + { branchcode => [ $library_id_1, $library_id_2 ] }, + { order_by => 'branchname' } + ); my $libraries = $c->objects->search( $libraries_rs ); $c->render( @@ -538,8 +541,8 @@ subtest 'objects.search helper, public requests' => sub { $schema->storage->txn_begin; - my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); - my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); + my $library_1 = $builder->build_object({ class => 'Koha::Libraries', value => { branchname => 'A' } }); + my $library_2 = $builder->build_object({ class => 'Koha::Libraries', value => { branchname => 'B' } }); my $t = Test::Mojo->new; -- 2.32.0