Fix errors on Korean translation files
[koha.git] / t / db_dependent / Record.t
blobe8d60948f9feb5f757af797e2b4ac3c26475ff67
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use Modern::Perl;
8 use Test::More tests => 11;
9 use MARC::Record;
11 BEGIN {
12 use_ok('C4::Record');
15 #my ($marc,$to_flavour,$from_flavour,$encoding) = @_;
17 my @marcarray=marc2marc;
18 is ($marcarray[0],"Feature not yet implemented\n","error works");
20 my $marc=new MARC::Record;
21 my $marcxml=marc2marcxml($marc);
22 my $testxml=qq(<?xml version="1.0" encoding="UTF-8"?>
23 <record
24 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25 xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
26 xmlns="http://www.loc.gov/MARC21/slim">
28 <leader> a </leader>
29 </record>
31 is ($marcxml, $testxml, "testing marc2xml");
33 my $rawmarc=$marc->as_usmarc;
34 $marcxml=marc2marcxml($rawmarc);
35 $testxml=qq(<?xml version="1.0" encoding="UTF-8"?>
36 <record
37 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
39 xmlns="http://www.loc.gov/MARC21/slim">
41 <leader>00026 a2200025 4500</leader>
42 </record>
44 is ($marcxml, $testxml, "testing marc2xml");
46 my $marcconvert=marcxml2marc($marcxml);
47 is ($marcconvert->as_xml,$marc->as_xml, "testing xml2marc");
49 my $marcdc=marc2dcxml($marc);
50 my $test2xml=qq(<?xml version="1.0" encoding="UTF-8"?>
51 <metadata
52 xmlns="http://example.org/myapp/"
53 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54 xsi:schemaLocation="http://example.org/myapp/ http://example.org/myapp/schema.xsd"
55 xmlns:dc="http://purl.org/dc/elements/1.1/"
56 xmlns:dcterms="http://purl.org/dc/terms/">
57 </metadata>);
59 is ($marcdc, $test2xml, "testing marc2dcxml");
61 my $marcqualified=marc2dcxml($marc,1);
62 my $test3xml=qq(<?xml version="1.0" encoding="UTF-8"?>
63 <metadata
64 xmlns="http://example.org/myapp/"
65 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66 xsi:schemaLocation="http://example.org/myapp/ http://example.org/myapp/schema.xsd"
67 xmlns:dc="http://purl.org/dc/elements/1.1/"
68 xmlns:dcterms="http://purl.org/dc/terms/">
69 </metadata>);
71 is ($marcqualified, $test3xml, "testing marcQualified");
73 my $mods=marc2modsxml($marc);
74 my $test4xml=qq(<?xml version="1.0" encoding="UTF-8"?>
75 <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.1" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-1.xsd">
76 <typeOfResource/>
77 <originInfo>
78 <issuance/>
79 </originInfo>
80 <recordInfo/>
81 </mods>
84 is ($mods, $test4xml, "testing marc2modsxml");
86 $marc->append_fields(MARC::Field->new(
87 '100', ' ', ' ', a => 'Rowling, J.K.'
88 ));
89 my $field = MARC::Field->new('245','','','a' => "Harry potter");
90 $marc->append_fields($field);
91 $marc->append_fields(MARC::Field->new(
92 '260', ' ', ' ', b => 'Scholastic', c => '2001'
93 ));
95 #my $endnote=marc2endnote($marc->as_usmarc);
96 #print $endnote;
98 my $bibtex=marc2bibtex($marc, 'testID');
99 my $test5xml=qq(\@book{testID,
100 author = {Rowling, J.K.},
101 title = {Harry potter},
102 publisher = {Scholastic},
103 year = {2001}
107 is ($bibtex, $test5xml, "testing bibtex");
109 $marc->append_fields(MARC::Field->new(
110 '264', '3', '1', b => 'Reprints', c => '2011'
112 $bibtex = marc2bibtex($marc, 'testID');
113 my $rdabibtex = qq(\@book{testID,
114 author = {Rowling, J.K.},
115 title = {Harry potter},
116 publisher = {Reprints},
117 year = {2011}
120 is ($bibtex, $rdabibtex, "testing bibtex with RDA 264 field");
122 my @entity=C4::Record::_entity_encode("Björn");
123 is ($entity[0], "Bj&#xC3;&#xB6;rn", "Html umlauts");