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
=> 42;
30 warning_is
{ @arr = AddBiblio
(undef, q{}) }
31 { carped
=> 'AddBiblio called with undefined record'},
32 "AddBiblio returns carped warning on undef record";
36 is
($elements, 0, 'Add Biblio returns empty array for undef record');
38 warning_is
{ $ret = ModBiblio
(undef, 0, '') }
39 { carped
=> 'No record passed to ModBiblio'},
40 "ModBiblio returns carped warning on undef record";
42 is
( $ret, 0, 'ModBiblio returns zero if not passed rec');
44 warning_is
{ $ret = BiblioAutoLink
(undef, q{}) }
45 { carped
=> 'Undefined record passed to BiblioAutoLink'},
46 "BiblioAutoLink returns carped warning on undef record";
48 is
( $ret, 0, 'BiblioAutoLink returns zero if not passed rec');
50 warning_is
{ $ret = GetRecordValue
('100', undef, q{}) }
51 { carped
=> 'GetRecordValue called with undefined record'},
52 "GetRecordValue returns carped warning on undef record";
54 ok
( !defined $ret, 'GetRecordValue returns undef if not passed rec');
56 warning_is
{ @arr = LinkBibHeadingsToAuthorities
(q{}, q{}) }
57 { carped
=> 'LinkBibHeadingsToAuthorities called on undefined bib record'},
58 "LinkBibHeadingsToAuthorities returns carped warning on undef record";
60 is
($arr[0], 0, 'LinkBibHeadingsToAuthorities correct error return');
62 warning_is
{ $ret = GetCOinSBiblio
() }
63 { carped
=> 'GetCOinSBiblio called with undefined record'},
64 "GetCOinSBiblio returns carped warning on undef record";
66 ok
( !defined $ret, 'GetCOinSBiblio returns undef if not passed rec');
68 warning_is
{ $ret = GetMarcPrice
(undef, 'MARC21') }
69 { carped
=> 'GetMarcPrice called on undefined record'},
70 "GetMarcPrice returns carped warning on undef record";
72 ok
( !defined $ret, 'GetMarcPrice returns undef if not passed rec');
74 warning_is
{ $ret = GetMarcQuantity
(undef, 'MARC21') }
75 { carped
=> 'GetMarcQuantity called on undefined record'},
76 "GetMarcQuantity returns carped warning on undef record";
78 ok
( !defined $ret, 'GetMarcQuantity returns undef if not passed rec');
80 warning_is
{ $ret = GetMarcControlnumber
() }
81 { carped
=> 'GetMarcControlnumber called on undefined record'},
82 "GetMarcControlnumber returns carped warning on undef record";
84 ok
( !defined $ret, 'GetMarcControlnumber returns undef if not passed rec');
86 warning_is
{ $ret = GetMarcISBN
() }
87 { carped
=> 'GetMarcISBN called on undefined record'},
88 "GetMarcISBN returns carped warning on undef record";
90 ok
( !defined $ret, 'GetMarcISBN returns undef if not passed rec');
92 warning_is
{ $ret = GetMarcISSN
() }
93 { carped
=> 'GetMarcISSN called on undefined record'},
94 "GetMarcISSN returns carped warning on undef record";
96 ok
( !defined $ret, 'GetMarcISSN returns undef if not passed rec');
98 warning_is
{ $ret = GetMarcNotes
() }
99 { carped
=> 'GetMarcNotes called on undefined record'},
100 "GetMarcNotes returns carped warning on undef record";
102 ok
( !defined $ret, 'GetMarcNotes returns undef if not passed rec');
104 warning_is
{ $ret = GetMarcSubjects
() }
105 { carped
=> 'GetMarcSubjects called on undefined record'},
106 "GetMarcSubjects returns carped warning on undef record";
108 ok
( !defined $ret, 'GetMarcSubjects returns undef if not passed rec');
110 warning_is
{ $ret = GetMarcAuthors
() }
111 { carped
=> 'GetMarcAuthors called on undefined record'},
112 "GetMarcAuthors returns carped warning on undef record";
114 ok
( !defined $ret, 'GetMarcAuthors returns undef if not passed rec');
116 warning_is
{ $ret = GetMarcUrls
() }
117 { carped
=> 'GetMarcUrls called on undefined record'},
118 "GetMarcUrls returns carped warning on undef record";
120 ok
( !defined $ret, 'GetMarcUrls returns undef if not passed rec');
122 warning_is
{ $ret = GetMarcSeries
() }
123 { carped
=> 'GetMarcSeries called on undefined record'},
124 "GetMarcSeries returns carped warning on undef record";
126 ok
( !defined $ret, 'GetMarcSeries returns undef if not passed rec');
128 warning_is
{ $ret = GetMarcHosts
() }
129 { carped
=> 'GetMarcHosts called on undefined record'},
130 "GetMarcHosts returns carped warning on undef record";
132 ok
( !defined $ret, 'GetMarcHosts returns undef if not passed rec');
136 warning_is
{ $hash_ref = TransformMarcToKoha
(undef, undef) }
137 { carped
=> 'TransformMarcToKoha called with undefined record'},
138 "TransformMarcToKoha returns carped warning on undef record";
140 isa_ok
( $hash_ref, 'HASH');
142 $elements = keys %{$hash_ref};
144 is
($elements, 0, 'Empty hashref returned for undefined record in TransformMarcToKoha');
146 warning_is
{ $ret = ModBiblioMarc
() }
147 { carped
=> 'ModBiblioMarc passed an undefined record'},
148 "ModBiblioMarc returns carped warning on undef record";
150 ok
( !defined $ret, 'ModBiblioMarc returns undef if not passed rec');
152 warning_is
{ $ret = RemoveAllNsb
() }
153 { carped
=> 'RemoveAllNsb called with undefined record'},
154 "RemoveAllNsb returns carped warning on undef record";
156 ok
( !defined $ret, 'RemoveAllNsb returns undef if not passed rec');