3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Test
::More tests
=> 2;
28 subtest
'GetMarcNotes MARC21' => sub {
30 t
::lib
::Mocks
::mock_preference
( 'NotesBlacklist', '520' );
32 my $record = MARC
::Record
->new;
33 $record->append_fields(
34 MARC
::Field
->new( '500', '', '', a
=> 'Note1' ),
35 MARC
::Field
->new( '505', '', '', a
=> 'Note2', u
=> 'http://someserver.com' ),
36 MARC
::Field
->new( '520', '', '', a
=> 'Note3 skipped' ),
38 my $notes = C4
::Biblio
::GetMarcNotes
( $record, 'MARC21' );
39 is
( $notes->[0]->{marcnote
}, 'Note1', 'First note' );
40 is
( $notes->[1]->{marcnote
}, 'Note2', 'Second note' );
41 is
( $notes->[2]->{marcnote
}, 'http://someserver.com', 'URL separated' );
42 is
( @
$notes, 3, 'No more notes' );
45 subtest
'GetMarcNotes UNIMARC' => sub {
47 t
::lib
::Mocks
::mock_preference
( 'NotesBlacklist', '310' );
49 my $record = MARC
::Record
->new;
50 $record->append_fields(
51 MARC
::Field
->new( '300', '', '', a
=> 'Note1' ),
52 MARC
::Field
->new( '300', '', '', a
=> 'Note2' ),
53 MARC
::Field
->new( '310', '', '', a
=> 'Note3 skipped' ),
55 my $notes = C4
::Biblio
::GetMarcNotes
( $record, 'UNIMARC' );
56 is
( $notes->[0]->{marcnote
}, 'Note1', 'First note' );
57 is
( $notes->[1]->{marcnote
}, 'Note2', 'Second note' );
58 is
( @
$notes, 2, 'No more notes' );