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 <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-07-26 13:05:17 +00:00 committed by Katrin Fischer
parent 2d5a7d19a3
commit b5ed6e5062
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 1 deletions

View File

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