From 6647789c053aef028838138084153ff2be4214a8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 9 Apr 2021 12:09:47 -0400 Subject: [PATCH] Bug 27774: Add unit test Signed-off-by: Kyle M Hall --- t/db_dependent/Biblio/TransformMarcToKoha.t | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Biblio/TransformMarcToKoha.t b/t/db_dependent/Biblio/TransformMarcToKoha.t index 60d7a95833..e2280e7024 100755 --- a/t/db_dependent/Biblio/TransformMarcToKoha.t +++ b/t/db_dependent/Biblio/TransformMarcToKoha.t @@ -42,20 +42,22 @@ Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '500', tagsu Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); subtest 'Test a few mappings' => sub { - plan tests => 7; + plan tests => 8; my $marc = MARC::Record->new; $marc->append_fields( + MARC::Field->new( '020', '', '', a => '978-0441-172719' ), MARC::Field->new( '300', '', '', a => 'a1', b => 'b1' ), MARC::Field->new( '300', '', '', a => 'a2', b => 'b2' ), MARC::Field->new( '500', '', '', a => 'note1', a => 'note2' ), ); my $result = C4::Biblio::TransformMarcToKoha( $marc ); # Note: TransformMarcToKoha stripped the table prefix biblio. - is( keys %{$result}, 3, 'Found all three mappings' ); + is( keys %{$result}, 4, 'Found all three mappings' ); is( $result->{field1}, 'a1 | a2', 'Check field1 results' ); is( $result->{field2}, 'b1 | b2', 'Check field2 results' ); is( $result->{field3}, 'note1 | note2', 'Check field3 results' ); + is( $result->{isbn}, '9780441172719', 'ISBN hypens have been removed' ); is( C4::Biblio::TransformMarcToKohaOneField( 'biblio.field1', $marc ), $result->{field1}, 'TransformMarcToKohaOneField returns biblio.field1'); @@ -67,7 +69,7 @@ subtest 'Test a few mappings' => sub { # CAUTION: This parameter of TransformMarcToKoha will be removed later my $new_fw = t::lib::TestBuilder->new->build({source => 'BiblioFramework'}); $result = C4::Biblio::TransformMarcToKoha($marc, $new_fw->{frameworkcode}); - is( keys %{$result}, 3, 'Still found all three mappings' ); + is( keys %{$result}, 4, 'Still found all three mappings' ); }; subtest 'Multiple mappings for one kohafield' => sub { -- 2.24.3 (Apple Git-128)