3 # Copyright 2012 C & P Bibliography Services
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 use_ok
('Koha::RecordProcessor');
33 my $module = new Test
::MockModule
('MARC::Record');
34 $module->mock('new_from_xml', sub {
35 my $record = MARC
::Record
->new;
39 [ '150', ' ', ' ', a
=> 'Cooking' ],
40 [ '450', ' ', ' ', a
=> 'Cookery' ],
46 my $bib = MARC
::Record
->new;
48 [ '245', '0', '4', a
=> 'The Ifrane cookbook' ],
49 [ '650', ' ', ' ', a
=> 'Cooking', 9 => '1234' ]
52 my $resultbib = MARC
::Record
->new;
53 $resultbib->add_fields(
54 [ '245', '0', '4', a
=> 'The Ifrane cookbook' ],
55 [ '650', ' ', ' ', a
=> 'Cooking', 9 => '1234' ],
56 [ '650', 'z', ' ', a
=> 'Cookery' ]
59 my $processor = Koha
::RecordProcessor
->new( { filters
=> ( 'EmbedSeeFromHeadings' ) } );
60 is
(ref($processor), 'Koha::RecordProcessor', 'Created record processor');
62 my $result = $processor->process($bib);
64 is_deeply
($result, $resultbib, 'Inserted see-from heading to record');