Lines 8-18
use warnings;
Link Here
|
8 |
|
8 |
|
9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
10 |
use Test::MockObject; |
10 |
use Test::MockObject; |
11 |
use Test::More tests => 5; |
11 |
use Test::More tests => 6; |
12 |
use t::lib::Mocks; |
12 |
use t::lib::Mocks; |
13 |
use MARC::Record; |
13 |
use MARC::Record; |
14 |
|
14 |
|
15 |
use C4::AuthoritiesMarc qw( FindDuplicateAuthority ); |
15 |
use C4::AuthoritiesMarc qw( FindDuplicateAuthority isAuthorityDuplicated ); |
16 |
|
16 |
|
17 |
BEGIN { |
17 |
BEGIN { |
18 |
use_ok('C4::AuthoritiesMarc::MARC21', qw( default_auth_type_location fix_marc21_auth_type_location )); |
18 |
use_ok('C4::AuthoritiesMarc::MARC21', qw( default_auth_type_location fix_marc21_auth_type_location )); |
Lines 60-62
subtest "FindDuplicateAuthority tests" => sub {
Link Here
|
60 |
is( $query, q{at:"GENRE/FORM" AND he:"Potato"}, "Query formed correctly for Elasticsearch"); |
60 |
is( $query, q{at:"GENRE/FORM" AND he:"Potato"}, "Query formed correctly for Elasticsearch"); |
61 |
|
61 |
|
62 |
}; |
62 |
}; |
63 |
- |
63 |
|
|
|
64 |
subtest "isAuthorityDuplicated tests" => sub { |
65 |
plan tests => 2; |
66 |
my $record1 = MARC::Record->new; |
67 |
$record1->append_fields( |
68 |
MARC::Field->new('110', '', '', a => 'Potato' ), |
69 |
); |
70 |
|
71 |
my $record2 = MARC::Record->new; |
72 |
$record2->append_fields( |
73 |
MARC::Field->new('110', '', '', a => 'Potato' ), |
74 |
); |
75 |
|
76 |
my $duplicate = isAuthorityDuplicated( $record1, $record2, "CORPO_NAME" ); |
77 |
is( $duplicate, 1 ); |
78 |
|
79 |
$record2->delete_fields($record2->field('110')); |
80 |
$record2->append_fields( |
81 |
MARC::Field->new('110', '', '', a => 'Newvalue' ), |
82 |
); |
83 |
|
84 |
$duplicate = isAuthorityDuplicated( $record1, $record2, "CORPO_NAME" ); |
85 |
is( $duplicate, 0 ); |
86 |
}; |