From 5652f3c52a5ba7cd8122cbf89f59761b8a29b2e1 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 --- 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 0309fa94f6..38188f6231 100755 --- 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.20.1