|
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::NoWarnings; |
22 |
use Test::NoWarnings; |
| 23 |
use Test::More tests => 3; |
23 |
use Test::More tests => 2; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
| 25 |
|
25 |
|
| 26 |
use t::lib::TestBuilder; |
26 |
use t::lib::TestBuilder; |
|
Link Here
|
| 55 |
is( $extractor->get_control_number, $identifier, 'Returns the right value' ); |
55 |
is( $extractor->get_control_number, $identifier, 'Returns the right value' ); |
| 56 |
} |
56 |
} |
| 57 |
}; |
57 |
}; |
| 58 |
|
|
|
| 59 |
subtest 'get_opac_suppression() tests' => sub { |
| 60 |
|
| 61 |
plan tests => 8; |
| 62 |
|
| 63 |
foreach my $marcflavour (qw( MARC21 UNIMARC )) { |
| 64 |
t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); |
| 65 |
|
| 66 |
my $record = MARC::Record->new(); |
| 67 |
my $extractor = Koha::Biblio::Metadata::Extractor->new( { metadata => $record } ); |
| 68 |
|
| 69 |
is( $extractor->get_opac_suppression(), 0, 'If 942$n absent, then not suppressed' ); |
| 70 |
|
| 71 |
$record->append_fields( MARC::Field->new( '942', q{}, q{}, n => '' ) ); |
| 72 |
is( $extractor->get_opac_suppression(), 0, 'If 942$n has empty string, then not suppressed' ); |
| 73 |
|
| 74 |
$record->field('942')->replace_with( MARC::Field->new( '942', q{}, q{}, n => 'potato' ) ); |
| 75 |
is( $extractor->get_opac_suppression(), 1, 'If 942$n has something different than false, then suppressed' ); |
| 76 |
|
| 77 |
$record->field('942')->replace_with( MARC::Field->new( '942', q{}, q{}, n => '1' ) ); |
| 78 |
is( $extractor->get_opac_suppression(), 1, 'If 942$n is 1, then suppressed' ); |
| 79 |
} |
| 80 |
}; |
| 81 |
- |