|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
use Modern::Perl; |
| 4 |
use Data::Dumper qw/Dumper/; |
| 5 |
use MARC::Record; |
| 6 |
use MARC::Field; |
| 7 |
use Test::More tests => 1; |
| 8 |
|
| 9 |
use Koha::Authority::BiblioIndicators; |
| 10 |
use Koha::Database; |
| 11 |
|
| 12 |
my $schema = Koha::Database->new->schema; |
| 13 |
$schema->storage->txn_begin; |
| 14 |
|
| 15 |
subtest "Trivial tests" => sub { |
| 16 |
plan tests => 6; |
| 17 |
|
| 18 |
my $oInd = Koha::Authority::BiblioIndicators->new; |
| 19 |
is_deeply( $oInd->get({}), {}, 'Empty hash for no parameters' ); |
| 20 |
my $record = MARC::Record->new; |
| 21 |
$record->append_fields( |
| 22 |
MARC::Field->new( '100', '3', '3', a => 'My name' ), |
| 23 |
); |
| 24 |
my $res = $oInd->get({ |
| 25 |
flavour => "MARC21", |
| 26 |
report_tag => '100', |
| 27 |
auth_record => $record, |
| 28 |
biblio_tag => '100', |
| 29 |
}); |
| 30 |
is( $res->{ind1}, '3', 'Check first indicator' ); |
| 31 |
is( exists $res->{ind2}, 1, 'Check existence of indicator2 key' ); |
| 32 |
is( $res->{ind2}, undef, 'Check second indicator value' ); |
| 33 |
|
| 34 |
$res = $oInd->get({ |
| 35 |
flavour => "MARC21", |
| 36 |
report_tag => '100', |
| 37 |
auth_record => $record, |
| 38 |
biblio_tag => '700', |
| 39 |
}); |
| 40 |
is( $res->{ind1}, '3', 'Check first indicator' ); |
| 41 |
is( exists $res->{ind2}, '', 'Check if indicator2 key does not exist' ); |
| 42 |
|
| 43 |
$oInd->clear; |
| 44 |
}; |
| 45 |
|
| 46 |
$schema->storage->txn_rollback; |