From b5ed6e506231fcaa94de83c4fc22ff257b9b7118 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 26 Jul 2024 13:05:17 +0000 Subject: [PATCH] Bug 35044: (QA follow-up): Fix flaky tests To test, run the following test file a couple times until it fails: prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t My testing this failed around 50% of the time so it should not take long to reproduce. I believe this is because the order of the array elements may differ. Apply this patch and run the test file again many times. It should never fail. Signed-off-by: Katrin Fischer --- Koha/Object/Mixin/AdditionalFields.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm index 18bc782bc0..90f8ab087f 100644 --- a/Koha/Object/Mixin/AdditionalFields.pm +++ b/Koha/Object/Mixin/AdditionalFields.pm @@ -104,7 +104,8 @@ sub prepare_cgi_additional_field_values { my ( $self, $cgi, $tablename ) = @_; my @additional_fields; - my $table_fields = Koha::AdditionalFields->search( { tablename => $tablename } ); + my $table_fields = + Koha::AdditionalFields->search( { tablename => $tablename }, { order_by => { -asc => 'id' } } ); while ( my $field = $table_fields->next ) { my @field_values = $cgi->multi_param( 'additional_field_' . $field->id ); -- 2.39.5