Bug 11032: Check a valid MARC::Record passed to Biblio
[koha.git] / t / Biblio.t
blob9a1b8f4e81f60293d235db5d4245ee4b2b82cace
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 use Test::More tests => 22;
8 BEGIN {
9 use_ok('C4::Biblio');
12 # test returns if undef record passed
13 # carp messages appear on stdout
15 my @arr = AddBiblio(undef, q{});
16 my $elements = @arr;
18 is($elements, 0, 'Add Biblio returns empty array for undef record');
20 my $ret = ModBiblio(undef, 0, '');
22 is( $ret, 0, 'ModBiblio returns zero if not passed rec');
24 $ret = BiblioAutoLink(undef, q{});
26 is( $ret, 0, 'BiblioAutoLink returns zero if not passed rec');
28 $ret = GetRecordValue('100', undef, q{});
29 ok( !defined $ret, 'GetRecordValue returns undef if not passed rec');
31 @arr = LinkBibHeadingsToAuthorities(q{}, q{});
32 is($arr[0], 0, 'LinkBibHeadingsToAuthorities correct error return');
34 $ret = GetCOinSBiblio();
35 ok( !defined $ret, 'GetCOinSBiblio returns undef if not passed rec');
37 $ret = GetMarcPrice(undef, 'MARC21');
38 ok( !defined $ret, 'GetMarcPrice returns undef if not passed rec');
40 $ret = GetMarcQuantity(undef, 'MARC21');
41 ok( !defined $ret, 'GetMarcQuantity returns undef if not passed rec');
43 $ret = GetMarcControlnumber();
44 ok( !defined $ret, 'GetMarcControlnumber returns undef if not passed rec');
46 $ret = GetMarcISBN();
47 ok( !defined $ret, 'GetMarcISBN returns undef if not passed rec');
49 $ret = GetMarcISSN();
50 ok( !defined $ret, 'GetMarcISSN returns undef if not passed rec');
52 $ret = GetMarcNotes();
53 ok( !defined $ret, 'GetMarcNotes returns undef if not passed rec');
55 $ret = GetMarcSubjects();
56 ok( !defined $ret, 'GetMarcSubjects returns undef if not passed rec');
58 $ret = GetMarcAuthors();
59 ok( !defined $ret, 'GetMarcAuthors returns undef if not passed rec');
61 $ret = GetMarcUrls();
62 ok( !defined $ret, 'GetMarcUrls returns undef if not passed rec');
64 $ret = GetMarcSeries();
65 ok( !defined $ret, 'GetMarcSeries returns undef if not passed rec');
67 $ret = GetMarcHosts();
68 ok( !defined $ret, 'GetMarcHosts returns undef if not passed rec');
70 my $hash_ref = TransformMarcToKoha(undef, undef);
72 isa_ok( $hash_ref, 'HASH');
74 $elements = keys %{$hash_ref};
76 is($elements, 0, 'Empty hashref returned for undefined record in TransformMarcToKoha');
78 $ret = ModBiblioMarc();
79 ok( !defined $ret, 'ModBiblioMarc returns undef if not passed rec');
81 $ret = RemoveAllNsb();
82 ok( !defined $ret, 'RemoveAllNsb returns undef if not passed rec');