Link Here
|
25 |
|
25 |
|
26 |
use MARC::Record; |
26 |
use MARC::Record; |
27 |
|
27 |
|
28 |
use Koha::MetadataExtractor; |
28 |
use Koha::Biblio::Metadata::Extractor; |
29 |
|
29 |
|
30 |
subtest 'new() tests' => sub { |
30 |
subtest 'new() tests' => sub { |
31 |
|
31 |
|
32 |
plan tests => 1; |
32 |
plan tests => 1; |
33 |
|
33 |
|
34 |
my $extractor = Koha::MetadataExtractor->new; |
34 |
my $extractor = Koha::Biblio::Metadata::Extractor->new; |
35 |
is( ref($extractor), 'Koha::MetadataExtractor' ); |
35 |
is( ref($extractor), 'Koha::Biblio::Metadata::Extractor' ); |
36 |
}; |
36 |
}; |
37 |
|
37 |
|
38 |
subtest 'get_extractor() tests' => sub { |
38 |
subtest 'get_extractor() tests' => sub { |
39 |
|
39 |
|
40 |
plan tests => 8; |
40 |
plan tests => 8; |
41 |
|
41 |
|
42 |
my $extractor = Koha::MetadataExtractor->new; |
42 |
my $extractor = Koha::Biblio::Metadata::Extractor->new; |
43 |
|
43 |
|
44 |
foreach my $schema (qw{ MARC21 UNIMARC }) { |
44 |
foreach my $schema (qw{ MARC21 UNIMARC }) { |
45 |
my $specific_extractor = $extractor->get_extractor( { schema => $schema } ); |
45 |
my $specific_extractor = $extractor->get_extractor( { schema => $schema } ); |
46 |
is( |
46 |
is( |
47 |
ref($specific_extractor), "Koha::MetadataExtractor::MARC::$schema", |
47 |
ref($specific_extractor), "Koha::Biblio::Metadata::Extractor::MARC::$schema", |
48 |
"Returns the right extractor library for schema ($schema)" |
48 |
"Returns the right extractor library for schema ($schema)" |
49 |
); |
49 |
); |
50 |
ok( exists $extractor->{extractors}->{$schema}, "Extractor for $schema cached" ); |
50 |
ok( exists $extractor->{extractors}->{$schema}, "Extractor for $schema cached" ); |
Link Here
|
73 |
|
73 |
|
74 |
plan tests => 6; |
74 |
plan tests => 6; |
75 |
|
75 |
|
76 |
my $extractor = Koha::MetadataExtractor->new; |
76 |
my $extractor = Koha::Biblio::Metadata::Extractor->new; |
77 |
|
77 |
|
78 |
my $record = MARC::Record->new(); |
78 |
my $record = MARC::Record->new(); |
79 |
|
79 |
|
80 |
my $mock_marc21 = Test::MockModule->new('Koha::MetadataExtractor::MARC::MARC21'); |
80 |
my $mock_marc21 = Test::MockModule->new('Koha::Biblio::Metadata::Extractor::MARC::MARC21'); |
81 |
$mock_marc21->mock( 'get_normalized_upc', sub { return 'MARC21' } ); |
81 |
$mock_marc21->mock( 'get_normalized_upc', sub { return 'MARC21' } ); |
82 |
|
82 |
|
83 |
my $mock_unimarc = Test::MockModule->new('Koha::MetadataExtractor::MARC::UNIMARC'); |
83 |
my $mock_unimarc = Test::MockModule->new('Koha::Biblio::Metadata::Extractor::MARC::UNIMARC'); |
84 |
$mock_unimarc->mock( 'get_normalized_upc', sub { return 'UNIMARC' } ); |
84 |
$mock_unimarc->mock( 'get_normalized_upc', sub { return 'UNIMARC' } ); |
85 |
|
85 |
|
86 |
foreach my $schema (qw{ MARC21 UNIMARC }) { |
86 |
foreach my $schema (qw{ MARC21 UNIMARC }) { |