Merge remote branch 'kc/master' into new/enh/bug_5917
[koha.git] / t / db_dependent / Biblio.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!  
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8 use Test::More tests => 6;
9 use MARC::Record;
10 use C4::Biblio;
11
12 BEGIN {
13         use_ok('C4::Biblio');
14 }
15
16 my $isbn = '0590353403';
17 my $title = 'Foundation';
18
19 my $marc_record=MARC::Record->new;
20 my $field = MARC::Field->new('020','','','a' => $isbn);
21 $marc_record->append_fields($field);
22 my($biblionumber,$biblioitemnumber) = AddBiblio($marc_record,'');
23 my $data = &GetBiblioData($biblionumber);
24 is($data->{Title},undef,'Makes sure title field in biblio is empty.');
25
26 $field = MARC::Field->new('245','','','a' => $title);
27 $marc_record->append_fields($field);
28 ModBiblio($marc_record,$biblionumber,'');
29 $data = &GetBiblioData($biblionumber);
30 is($data->{title},$title,'uses ModBiblio to add a title to the previously created record and checks that its there.');
31 is($data->{isbn},$isbn,'Makes sure the isbn is still there after using ModBiblio.');
32
33 my $itemdata = &GetBiblioItemData($biblioitemnumber);
34 is($itemdata->{title},$title,'First test of GetBiblioItemData to get same result of previous two GetBiblioData tests.');
35 is($itemdata->{isbn},$isbn,'Second test checking it returns the correct isbn.');
36
37
38 # clean up after ourselves
39 DelBiblio($biblionumber);