Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 12; |
5 |
use Test::More tests => 13; |
6 |
use MARC::Record; |
6 |
use MARC::Record; |
7 |
|
7 |
|
8 |
use C4::Context; |
8 |
use C4::Context; |
Lines 50-81
is ($marcxml, $testxml, "testing marc2xml");
Link Here
|
50 |
my $marcconvert=marcxml2marc($marcxml); |
50 |
my $marcconvert=marcxml2marc($marcxml); |
51 |
is ($marcconvert->as_xml,$marc->as_xml, "testing xml2marc"); |
51 |
is ($marcconvert->as_xml,$marc->as_xml, "testing xml2marc"); |
52 |
|
52 |
|
53 |
my $marcdc=marc2dcxml($marc); |
53 |
my $marcsrwdc=marc2dcxml( $marc, undef, undef, "srwdc" ); |
54 |
my $test2xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
54 |
my $test2xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
55 |
<metadata |
55 |
<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd"> |
56 |
xmlns="http://example.org/myapp/" |
56 |
<type xmlns="http://purl.org/dc/elements/1.1/"/> |
57 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
57 |
</srw_dc:dc> |
58 |
xsi:schemaLocation="http://example.org/myapp/ http://example.org/myapp/schema.xsd" |
58 |
); |
59 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
|
60 |
xmlns:dcterms="http://purl.org/dc/terms/"> |
61 |
</metadata>); |
62 |
|
59 |
|
63 |
is ($marcdc, $test2xml, "testing marc2dcxml"); |
60 |
is ($marcsrwdc, $test2xml, "testing SRWDC Metadata"); |
64 |
|
61 |
|
65 |
my $marcqualified=marc2dcxml($marc,1); |
62 |
my $marcoaidc=marc2dcxml( $marc, undef, undef, "oaidc" ); |
66 |
my $test3xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
63 |
my $test3xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
67 |
<metadata |
64 |
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> |
68 |
xmlns="http://example.org/myapp/" |
65 |
<dc:type/> |
69 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
66 |
<dc:language/> |
70 |
xsi:schemaLocation="http://example.org/myapp/ http://example.org/myapp/schema.xsd" |
67 |
</oai_dc:dc> |
71 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
68 |
); |
72 |
xmlns:dcterms="http://purl.org/dc/terms/"> |
|
|
73 |
</metadata>); |
74 |
|
69 |
|
75 |
is ($marcqualified, $test3xml, "testing marcQualified"); |
70 |
is ($marcoaidc, $test3xml, "testing OAIDC Metadata"); |
76 |
|
71 |
|
77 |
my $mods=marc2modsxml($marc); |
72 |
my $marcrdfdc=marc2dcxml( $marc, undef, undef, "rdfdc" ); |
78 |
my $test4xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
73 |
my $test4xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
|
|
74 |
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
75 |
<dc:type/> |
76 |
<dc:language/> |
77 |
</rdf:Description> |
78 |
); |
79 |
|
80 |
is ($marcrdfdc, $test4xml, "testing OAIDC Metadata"); |
81 |
|
82 |
my $mods=marc2modsxml($marc); |
83 |
my $test5xml=qq(<?xml version="1.0" encoding="UTF-8"?> |
79 |
<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"> |
84 |
<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"> |
80 |
<typeOfResource/> |
85 |
<typeOfResource/> |
81 |
<originInfo> |
86 |
<originInfo> |
Lines 85-91
my $test4xml=qq(<?xml version="1.0" encoding="UTF-8"?>
Link Here
|
85 |
</mods> |
90 |
</mods> |
86 |
); |
91 |
); |
87 |
|
92 |
|
88 |
is ($mods, $test4xml, "testing marc2modsxml"); |
93 |
is ($mods, $test5xml, "testing marc2modsxml"); |
89 |
|
94 |
|
90 |
$marc->append_fields(MARC::Field->new( |
95 |
$marc->append_fields(MARC::Field->new( |
91 |
'100', ' ', ' ', a => 'Rowling, J.K.' |
96 |
'100', ' ', ' ', a => 'Rowling, J.K.' |
Lines 100-106
$marc->append_fields(MARC::Field->new(
Link Here
|
100 |
#print $endnote; |
105 |
#print $endnote; |
101 |
|
106 |
|
102 |
my $bibtex=marc2bibtex($marc, 'testID'); |
107 |
my $bibtex=marc2bibtex($marc, 'testID'); |
103 |
my $test5xml=qq(\@book{testID, |
108 |
my $test6xml=qq(\@book{testID, |
104 |
author = {Rowling, J.K.}, |
109 |
author = {Rowling, J.K.}, |
105 |
title = {Harry potter}, |
110 |
title = {Harry potter}, |
106 |
publisher = {Scholastic}, |
111 |
publisher = {Scholastic}, |
Lines 108-118
my $test5xml=qq(\@book{testID,
Link Here
|
108 |
} |
113 |
} |
109 |
); |
114 |
); |
110 |
|
115 |
|
111 |
is ($bibtex, $test5xml, "testing bibtex"); |
116 |
is ($bibtex, $test6xml, "testing bibtex"); |
112 |
|
117 |
|
113 |
C4::Context->set_preference( "BibtexExportAdditionalFields", "'\@': 260\$b\ntest: 260\$b" ); |
118 |
C4::Context->set_preference( "BibtexExportAdditionalFields", "'\@': 260\$b\ntest: 260\$b" ); |
114 |
$bibtex = marc2bibtex( $marc, 'testID' ); |
119 |
$bibtex = marc2bibtex( $marc, 'testID' ); |
115 |
my $test6xml = qq(\@Scholastic{testID, |
120 |
my $test7xml = qq(\@Scholastic{testID, |
116 |
\tauthor = {Rowling, J.K.}, |
121 |
\tauthor = {Rowling, J.K.}, |
117 |
\ttitle = {Harry potter}, |
122 |
\ttitle = {Harry potter}, |
118 |
\tpublisher = {Scholastic}, |
123 |
\tpublisher = {Scholastic}, |
Lines 120-126
my $test6xml = qq(\@Scholastic{testID,
Link Here
|
120 |
\ttest = {Scholastic} |
125 |
\ttest = {Scholastic} |
121 |
} |
126 |
} |
122 |
); |
127 |
); |
123 |
is( $bibtex, $test6xml, "testing bibtex" ); |
128 |
is( $bibtex, $test7xml, "testing bibtex" ); |
124 |
C4::Context->set_preference( "BibtexExportAdditionalFields", q{} ); |
129 |
C4::Context->set_preference( "BibtexExportAdditionalFields", q{} ); |
125 |
|
130 |
|
126 |
$marc->append_fields(MARC::Field->new( |
131 |
$marc->append_fields(MARC::Field->new( |
127 |
- |
|
|