From 8293c73bacb55dda87025a7986019754e490fa25 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 13 Nov 2020 09:32:50 +0100 Subject: [PATCH] Bug 27007: Don't call GetMarcSubfieldStructure with unsafe in tests It does not feel correct to call GetMarcSubfieldStructure with the unsafe flag set in tests: my $mss = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } ); Some tests are failing is run twice Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. [x~10] Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. # Failed test 'Value is mapped correctly for column biblionumber' # at t/db_dependent/Koha/Item.t line 115. # got: undef # expected: '483' [etc.] Test plan: Run the tests twice, without the patch it fails, with the patch it passes Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 3376a9440050d795ce0738e20b0616b782143f4b) Signed-off-by: Andrew Fuerste-Henry --- t/db_dependent/Koha/Item.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index b71ba4d1da..0fb0913391 100644 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -88,7 +88,7 @@ subtest 'has_pending_hold() tests' => sub { subtest "as_marc_field() tests" => sub { - my $mss = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } ); + my $mss = C4::Biblio::GetMarcSubfieldStructure( '' ); my @schema_columns = $schema->resultset('Item')->result_source->columns; my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns; @@ -139,7 +139,7 @@ subtest "as_marc_field() tests" => sub { } )->store; - $mss = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 0 } ); + $mss = C4::Biblio::GetMarcSubfieldStructure( '' ); my @unlinked_subfields; push @unlinked_subfields, X => 'Something weird'; $item->more_subfields_xml( C4::Items::_get_unlinked_subfields_xml( \@unlinked_subfields ) )->store; -- 2.39.5