Bug 23406: Unit test

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1489950a59)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a6b2e6e941)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2021-05-10 12:01:55 +00:00 committed by Andrew Fuerste-Henry
parent 26bb5683bd
commit 9483b81b0f
1 changed files with 13 additions and 1 deletions

View File

@ -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' });