|
Lines 25-30
use Koha::Authority;
Link Here
|
| 25 |
|
25 |
|
| 26 |
use Test::More; |
26 |
use Test::More; |
| 27 |
use Test::MockModule; |
27 |
use Test::MockModule; |
|
|
28 |
use Test::MockObject; |
| 28 |
|
29 |
|
| 29 |
BEGIN { |
30 |
BEGIN { |
| 30 |
use_ok('Koha::RecordProcessor'); |
31 |
use_ok('Koha::RecordProcessor'); |
|
Lines 63-66
my $result = $processor->process($bib);
Link Here
|
| 63 |
|
64 |
|
| 64 |
is_deeply($result, $resultbib, 'Inserted see-from heading to record'); |
65 |
is_deeply($result, $resultbib, 'Inserted see-from heading to record'); |
| 65 |
|
66 |
|
|
|
67 |
|
| 68 |
subtest "EmbedSeeFromHeadings should skip holdings fields" => sub { |
| 69 |
|
| 70 |
plan tests => 1; |
| 71 |
|
| 72 |
my $biblio_record = MARC::Record->new; |
| 73 |
$biblio_record->add_fields( |
| 74 |
[ '245', '0', '4', a => 'The Ifrane cookbook' ], |
| 75 |
[ '952', ' ', ' ', a => 'Cooking', 9 => '1234' ] |
| 76 |
); |
| 77 |
|
| 78 |
my $record_copy = MARC::Record->new; |
| 79 |
$record_copy->add_fields( |
| 80 |
[ '245', '0', '4', a => 'The Ifrane cookbook' ], |
| 81 |
[ '952', ' ', ' ', a => 'Cooking', 9 => '1234' ] |
| 82 |
); |
| 83 |
|
| 84 |
|
| 85 |
my $koha_authority = new Test::MockModule('Koha::Authority'); |
| 86 |
$koha_authority->mock( 'get_from_authid', sub { |
| 87 |
|
| 88 |
my $auth_record = MARC::Record->new; |
| 89 |
|
| 90 |
$auth_record->add_fields( |
| 91 |
[ '001', '1234' ], |
| 92 |
[ '150', ' ', ' ', a => 'Cooking' ], |
| 93 |
[ '450', ' ', ' ', a => 'Cookery' ], |
| 94 |
); |
| 95 |
|
| 96 |
my $authority_object = Test::MockObject->new(); |
| 97 |
$authority_object->mock( 'authid', sub { return '1234'; }); |
| 98 |
$authority_object->mock( 'authtype', sub { return 'TOPIC_TERM'; }); |
| 99 |
$authority_object->mock( 'schema', sub { return 'marc21'; }); |
| 100 |
$authority_object->mock( 'record', sub { return $auth_record; }); |
| 101 |
|
| 102 |
return $authority_object; |
| 103 |
}); |
| 104 |
|
| 105 |
my $processor = Koha::RecordProcessor->new({ |
| 106 |
filters => ( 'EmbedSeeFromHeadings' ) |
| 107 |
}); |
| 108 |
|
| 109 |
my $result = $processor->process($biblio_record); |
| 110 |
|
| 111 |
is_deeply($result, $record_copy, 'Holdings fields not processed to introduce See-from heading'); |
| 112 |
}; |
| 113 |
|
| 66 |
done_testing(); |
114 |
done_testing(); |
| 67 |
- |
|
|