From 3376b92a1d9861ddf7e53e6902a338c36a8c26bb Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Thu, 23 Jan 2025 17:11:00 +0100 Subject: [PATCH] Bug 38528: (follow-up) add test for prepare_cgi_additional_field_values Signed-off-by: Pedro Amorim Signed-off-by: Jonathan Druart --- .../Koha/Object/Mixin/AdditionalFields.t | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Object/Mixin/AdditionalFields.t b/t/db_dependent/Koha/Object/Mixin/AdditionalFields.t index 2b801e19c1c..8026032307c 100755 --- a/t/db_dependent/Koha/Object/Mixin/AdditionalFields.t +++ b/t/db_dependent/Koha/Object/Mixin/AdditionalFields.t @@ -242,6 +242,13 @@ subtest 'prepare_cgi_additional_field_values' => sub { } ); $field2->store()->discard_changes(); + my $field3 = Koha::AdditionalField->new( + { + tablename => 'subscription', + name => random_string( 'c' x 100 ) + } + ); + $field3->store()->discard_changes(); my $q = CGI->new; $q->param( @@ -252,6 +259,10 @@ subtest 'prepare_cgi_additional_field_values' => sub { -name => 'additional_field_' . $field2->id, -value => '0', ); + $q->param( + -name => 'additional_field_' . $field3->id, + -value => '', + ); $q->param( -name => 'irrelevant_param', -value => 'foo', @@ -274,13 +285,15 @@ subtest 'prepare_cgi_additional_field_values' => sub { { 'value' => '0', 'id' => $field2->id + }, + { + 'value' => '', + 'id' => $field3->id } ], 'Return of prepare_cgi_additional_field_values should be correct' ); - $schema->txn_rollback; - }; subtest 'strings_map() tests' => sub { -- 2.34.1