@@ -, +, @@ Koha::Authority::BiblioIndicators --- t/db_dependent/Authority/BiblioIndicators.t | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 t/db_dependent/Authority/BiblioIndicators.t --- a/t/db_dependent/Authority/BiblioIndicators.t +++ a/t/db_dependent/Authority/BiblioIndicators.t @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use Modern::Perl; +use Data::Dumper qw/Dumper/; +use MARC::Record; +use MARC::Field; +use Test::More tests => 1; + +use Koha::Authority::BiblioIndicators; +use Koha::Database; + +my $schema = Koha::Database->new->schema; +$schema->storage->txn_begin; + +subtest "Trivial tests" => sub { + plan tests => 6; + + my $oInd = Koha::Authority::BiblioIndicators->new; + is_deeply( $oInd->get({}), {}, 'Empty hash for no parameters' ); + my $record = MARC::Record->new; + $record->append_fields( + MARC::Field->new( '100', '3', '3', a => 'My name' ), + ); + my $res = $oInd->get({ + flavour => "MARC21", + report_tag => '100', + auth_record => $record, + biblio_tag => '100', + }); + is( $res->{ind1}, '3', 'Check first indicator' ); + is( exists $res->{ind2}, 1, 'Check existence of indicator2 key' ); + is( $res->{ind2}, undef, 'Check second indicator value' ); + + $res = $oInd->get({ + flavour => "MARC21", + report_tag => '100', + auth_record => $record, + biblio_tag => '700', + }); + is( $res->{ind1}, '3', 'Check first indicator' ); + is( exists $res->{ind2}, '', 'Check if indicator2 key does not exist' ); + + $oInd->clear; +}; + +$schema->storage->txn_rollback; --