Bug 26581: Only reindex records once per checkin
[koha.git] / t / db_dependent / Heading.t
blobe2f70646675fb5477113444078ca6705dc844467
1 #!/usr/bin/perl
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>.
18 use strict;
19 use warnings;
21 use Test::More tests => 3;
23 use t::lib::Mocks;
25 BEGIN {
26 use_ok('C4::Heading');
29 subtest "MARC21 tests" => sub {
30 plan tests => 9;
32 t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
34 ok(C4::Heading::valid_heading_subfield('100', 'a'), '100a valid for bib');
35 ok(!C4::Heading::valid_heading_subfield('100', 'e'), '100e not valid for bib');
37 ok(C4::Heading::valid_heading_subfield('100', 'a', 1), '100a valid for authority');
38 ok(!C4::Heading::valid_heading_subfield('100', 'e', 1), '100e not valid for authority');
40 ok(C4::Heading::valid_heading_subfield('110', 'a'), '110a valid for bib');
41 ok(!C4::Heading::valid_heading_subfield('110', 'e'), '110e not valid for bib');
43 ok(C4::Heading::valid_heading_subfield('600', 'a'), '600a valid for bib');
44 ok(!C4::Heading::valid_heading_subfield('600', 'e'), '600e not valid for bib');
46 ok(!C4::Heading::valid_heading_subfield('012', 'a'), '012a invalid field for bib');
49 subtest "UNIMARC tests" => sub {
50 plan tests => 7;
52 t::lib::Mocks::mock_preference('marcflavour', 'UNIMARC');
54 ok(C4::Heading::valid_heading_subfield('100', 'a'), '100a valid for bib');
55 ok(!C4::Heading::valid_heading_subfield('100', 'i'), '100i not valid fir bib');
57 ok(C4::Heading::valid_heading_subfield('110', 'a'), '110a valid for bib');
58 ok(!C4::Heading::valid_heading_subfield('110', 'i'), '110i not valid for bib');
60 ok(C4::Heading::valid_heading_subfield('600', 'a'), '600a valid for bib');
61 ok(!C4::Heading::valid_heading_subfield('600', 'i'), '600i not valid for bib');
63 ok(!C4::Heading::valid_heading_subfield('012', 'a'), '012a invalid field for bib');