Lines 5-16
Link Here
|
5 |
|
5 |
|
6 |
use strict; |
6 |
use strict; |
7 |
use warnings; |
7 |
use warnings; |
8 |
use Test::More tests => 9; |
8 |
use Test::More tests => 17; |
9 |
use MARC::Record; |
9 |
use MARC::Record; |
10 |
use C4::Biblio; |
10 |
use C4::Biblio; |
11 |
|
11 |
|
12 |
BEGIN { |
12 |
BEGIN { |
13 |
use_ok('C4::Biblio'); |
13 |
use_ok('C4::Biblio'); |
14 |
} |
14 |
} |
15 |
|
15 |
|
16 |
my $isbn = '0590353403'; |
16 |
my $isbn = '0590353403'; |
Lines 69-73
eval {
Link Here
|
69 |
}; |
69 |
}; |
70 |
ok($success, "ModBiblio handles 655 with no subfields"); |
70 |
ok($success, "ModBiblio handles 655 with no subfields"); |
71 |
|
71 |
|
|
|
72 |
# Testing GetMarcISSN |
73 |
my $issns; |
74 |
$issns = GetMarcISSN( $marc_record, 'MARC21' ); |
75 |
is( $issns->[0], undef, |
76 |
'GetMarcISSN handles records without 022 (list is empty)' ); |
77 |
is( scalar @$issns, 0, 'GetMarcISSN handles records without 022 (number of elements correct)' ); |
78 |
|
79 |
my $issn = '1234-1234'; |
80 |
$field = MARC::Field->new( '022', '', '', 'a', => $issn ); |
81 |
$marc_record->append_fields($field); |
82 |
$issns = GetMarcISSN( $marc_record, 'MARC21' ); |
83 |
is( $issns->[0], $issn, |
84 |
'GetMarcISSN handles records with single 022 (first element is correct)' ); |
85 |
is( scalar @$issns, 1, 'GetMARCISSN handles records with single 022 (number of elements correct)' |
86 |
); |
87 |
|
88 |
my @more_issns = qw/1111-1111 2222-2222 3333-3333/; |
89 |
foreach (@more_issns) { |
90 |
$field = MARC::Field->new( '022', '', '', 'a', => $_ ); |
91 |
$marc_record->append_fields($field); |
92 |
} |
93 |
$issns = GetMarcISSN( $marc_record, 'MARC21' ); |
94 |
is( scalar @$issns, 4, 'GetMARCISSN handles records with multiple 022 (number of elements correct)' |
95 |
); |
96 |
|
97 |
# Testing GetMarcControlnumber |
98 |
my $controlnumber; |
99 |
$controlnumber = GetMarcControlnumber( $marc_record, 'MARC21' ); |
100 |
is( $controlnumber, '', 'GetMarcControlnumber handles records without 001' ); |
101 |
|
102 |
$field = MARC::Field->new( '001', '' ); |
103 |
$marc_record->append_fields($field); |
104 |
$controlnumber = GetMarcControlnumber( $marc_record, 'MARC21' ); |
105 |
is( $controlnumber, '', 'GetMarcControlnumber handles records with empty 001' ); |
106 |
|
107 |
$field = $marc_record->field('001'); |
108 |
$field->update('123456789X'); |
109 |
$controlnumber = GetMarcControlnumber( $marc_record, 'MARC21' ); |
110 |
is( $controlnumber, '123456789X', 'GetMarcControlnumber handles records with 001' ); |
111 |
|
72 |
# clean up after ourselves |
112 |
# clean up after ourselves |
73 |
DelBiblio($biblionumber); |
113 |
DelBiblio($biblionumber); |
74 |
- |
|
|