From a6b2e6e9413700d3bd78b71807c3270aec46de87 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 10 May 2021 12:01:55 +0000 Subject: [PATCH] Bug 23406: Unit test Signed-off-by: Phil Ringnalda Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 1489950a593fb9caf5db52017580302bca7daf75) Signed-off-by: Fridolin Somers --- t/db_dependent/XSLT.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t index 2d9e9db1b3..1710d55cbe 100755 --- a/t/db_dependent/XSLT.t +++ b/t/db_dependent/XSLT.t @@ -17,7 +17,8 @@ use Modern::Perl; -use Test::More tests => 2; +use MARC::Record; +use Test::More tests => 3; use Test::Warn; use t::lib::TestBuilder; use t::lib::Mocks; @@ -33,6 +34,17 @@ my $builder = t::lib::TestBuilder->new; $schema->storage->txn_begin; +subtest 'transformMARCXML4XSLT tests' => sub { + plan tests => 1; + my $mock_xslt = Test::MockModule->new("C4::XSLT"); + $mock_xslt->mock( getAuthorisedValues4MARCSubfields => sub { return { 942 => { 'n' => 1 } } } ); + $mock_xslt->mock( GetAuthorisedValueDesc => sub { warn "called"; }); + my $record = MARC::Record->new(); + my $suppress_field = MARC::Field->new( 942, ' ', ' ', n => '1' ); + $record->append_fields($suppress_field); + warning_is { C4::XSLT::transformMARCXML4XSLT( 3,$record ) } undef, "942n auth value not translated"; +}; + subtest 'buildKohaItemsNamespace status tests' => sub { plan tests => 13; my $itype = $builder->build_object({ class => 'Koha::ItemTypes' }); -- 2.39.2