Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use Modern::Perl; |
4 |
use Test::More tests => 4; |
5 |
use XML::Simple; |
6 |
|
7 |
use C4::Biblio qw/TransformHtmlToXml/; |
8 |
|
9 |
my $tags= [ '001', '100', '245', '245' ]; |
10 |
my $subfields = [ '', 'a', 'a', 'c' ]; |
11 |
my $values = [ '12345', 'author', 'title', 'resp' ]; |
12 |
my $ind = [ ' ', '00', ' 9', ' ' ]; |
13 |
|
14 |
my $xml = TransformHtmlToXml( $tags, $subfields, $values, $ind, undef, 'MARC21' ); |
15 |
my $xmlh = XML::Simple->new->XMLin( $xml ); |
16 |
|
17 |
# check number of controlfields |
18 |
is( ref $xmlh->{record}->{controlfield}, 'HASH', 'One controlfield' ); |
19 |
# check datafields |
20 |
my $cnt = @{$xmlh->{record}->{datafield}}; |
21 |
is( $cnt, 2, 'Two datafields' ); |
22 |
# check value of 245c |
23 |
is( $xmlh->{record}->{datafield}->[1]->{subfield}->[1]->{content}, 'resp', 'Check value' ); |
24 |
# check second indicator of 245 |
25 |
is( $xmlh->{record}->{datafield}->[1]->{ind2}, '9', 'Check indicator' ); |