|
Line 0
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use Modern::Perl; |
| 4 |
use Test::More tests => 8; |
| 5 |
|
| 6 |
use t::lib::Mocks; |
| 7 |
use C4::Context; |
| 8 |
use MARC::Field; |
| 9 |
|
| 10 |
BEGIN{ |
| 11 |
use_ok('C4::AuthoritiesMarc'); |
| 12 |
} |
| 13 |
|
| 14 |
t::lib::Mocks::mock_preference('marcflavour', 'UNIMARC'); |
| 15 |
|
| 16 |
is( C4::AuthoritiesMarc::authorityflavour(), q{UNIMARCAUTH}, 'marcflavour returns "UNIMARCAUTH" if UNIMARC' ); |
| 17 |
|
| 18 |
|
| 19 |
my @fields = ( |
| 20 |
MARC::Field->new( |
| 21 |
200, '', '', |
| 22 |
a => 'text0', |
| 23 |
d => '2010', |
| 24 |
), |
| 25 |
MARC::Field->new( |
| 26 |
201, '', '', |
| 27 |
a => 'text1', |
| 28 |
c => '2001', |
| 29 |
), |
| 30 |
MARC::Field->new( |
| 31 |
202, '', '', |
| 32 |
a => 'text2', |
| 33 |
9 => '2002', |
| 34 |
), |
| 35 |
MARC::Field->new( |
| 36 |
203, '', '', |
| 37 |
b => 'text3', |
| 38 |
h => '2003', |
| 39 |
), |
| 40 |
); |
| 41 |
|
| 42 |
is( C4::AuthoritiesMarc::_test_string( 'text0', @fields ), 1, "text0 exists" ); |
| 43 |
is( C4::AuthoritiesMarc::_test_string( '2001', @fields ), 1, "2001 exists" ); |
| 44 |
is( C4::AuthoritiesMarc::_test_string( 'text2', @fields ), 1, "text2 exists" ); |
| 45 |
is( C4::AuthoritiesMarc::_test_string( '2003', @fields ), 1, "2003 exists" ); |
| 46 |
is( C4::AuthoritiesMarc::_test_string( 'text4', @fields ), 0, "text4 does not exist" ); |
| 47 |
is( C4::AuthoritiesMarc::_test_string( '2004', @fields ), 0, "2004 does not exist" ); |
| 48 |
|