3 # This Koha test module is a stub!
4 # Add more tests here!!!
8 use Test::More tests => 9;
16 my $isbn = '0590353403';
17 my $title = 'Foundation';
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.');
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.');
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.');
38 $field = MARC::Field->new(
40 'a' => 'Auction catalogs',
44 $marc_record->append_fields($field);
45 $success = ModBiblio($marc_record,$biblionumber,'');
50 ok($success, "ModBiblio handles authority-linked 655");
53 $field->delete_subfields('a');
54 $marc_record->append_fields($field);
55 $success = ModBiblio($marc_record,$biblionumber,'');
60 ok($success, "ModBiblio handles 655 with authority link but no heading");
63 $field->delete_subfields('9');
64 $marc_record->append_fields($field);
65 $success = ModBiblio($marc_record,$biblionumber,'');
70 ok($success, "ModBiblio handles 655 with no subfields");
72 # clean up after ourselves
73 DelBiblio($biblionumber);