Bugzilla – Attachment 43545 Details for
Bug 13642
Adding new features for Dublin Core metadata
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13642 - Unit Test for Koha::DublinCore.pm
Bug-13642---Unit-Test-for-KohaDublinCorepm.patch (text/plain), 15.47 KB, created by
Héctor Eduardo Castro Avalos
on 2015-10-16 21:38:55 UTC
(
hide
)
Description:
Bug 13642 - Unit Test for Koha::DublinCore.pm
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2015-10-16 21:38:55 UTC
Size:
15.47 KB
patch
obsolete
>From 3224e1996510661a4c742dba04bd8bd4d03d4e2f Mon Sep 17 00:00:00 2001 >From: Hector Castro <hector.hecaxmmx@gmail.com> >Date: Fri, 16 Oct 2015 15:41:57 -0600 >Subject: [PATCH] Bug 13642 - Unit Test for Koha::DublinCore.pm > >To test >-Apply patches >-prove t/db_dependent/DublinCore.t >--- > t/db_dependent/DublinCore.t | 293 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 293 insertions(+) > create mode 100644 t/db_dependent/DublinCore.t > >diff --git a/t/db_dependent/DublinCore.t b/t/db_dependent/DublinCore.t >new file mode 100644 >index 0000000..58c6e08 >--- /dev/null >+++ b/t/db_dependent/DublinCore.t >@@ -0,0 +1,293 @@ >+#!/usr/bin/perl >+ >+# >+# This file is part of Koha. >+# >+# Copyright (C) 2015 Universidad de El Salvador, >+# Facultad Multidisciplinaria Oriental >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+# >+ >+use Modern::Perl; >+ >+use Test::More tests => 11; >+use MARC::Record; >+ >+BEGIN { >+ use_ok('Koha::DublinCore'); >+} >+ >+## create a MARC::Record object. >+my $record = MARC::Record->new(); >+$record->leader('00000cam a2200000 i 4500'); >+my $control_number = MARC::Field->new( '001', '55645069' ); >+$record->append_fields($control_number); >+my $date_time_transection = MARC::Field->new( '005', '20050131000000.0' ); >+$record->append_fields($date_time_transection); >+my $fixed_length = MARC::Field->new( '008', '040526t20042004nju b 001 0 eng d' ); >+$record->append_fields($fixed_length); >+ >+my $LCCN = MARC::Field->new( >+ '010','','', >+ a => '2004051516' >+ ); >+$record->append_fields($LCCN); >+ >+my $author = MARC::Field->new( >+ '100',1,'', >+ a => 'Logan, Robert K.', >+ d => '1939-' >+ ); >+$record->append_fields($author); >+ >+my $title = MARC::Field->new( >+ '245','1','4', >+ a => 'The alphabet effect /', >+ c => 'Robert K. Logan.' >+ ); >+$record->append_fields($title); >+ >+my $publisher = MARC::Field->new( >+ '260','','', >+ a => 'Cresskill, N.J. :', >+ b => 'Hampton Press,', >+ c => '[2004]' >+ ); >+$record->append_fields($publisher); >+ >+my $physical_escription = MARC::Field->new( >+ '300','','', >+ a => 'xiv, 265 pages :', >+ c => '24 cm' >+ ); >+$record->append_fields($physical_escription); >+ >+my $bibliography = MARC::Field->new( >+ '504','','', >+ a => 'Includes bibliographical references (pages 247-255) and indexes' >+ ); >+$record->append_fields($bibliography); >+ >+my $subject = MARC::Field->new( >+ '650','','0', >+ a => 'Alphabet', >+ x => 'History.' >+ ); >+$record->append_fields($subject); >+ >+ ok( defined $record, 'Returned new()' ); >+ ok( $record->isa('MARC::Record'), "Right class for creating MARC records" ); >+ >+#Koha::DublinCore object for XML metadata >+my $xml_dc_record = Koha::DublinCore->new({ >+ type => 'xml', >+ qualified => 0, >+ get_marc_record => $record >+ }); >+ >+#Koha::DublinCore object for RDF metadata >+my $rdf_dc_record = Koha::DublinCore->new({ >+ type => 'rdf', >+ qualified => 0, >+ get_marc_record => $record, >+ }); >+ >+#OAI-DC >+my $test4 = qq(<?xml version="1.0" encoding="utf-8"?> >+<oai_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> >+ <dc:title>The alphabet effect / Robert K. Logan.</dc:title> >+ <dc:creator>Logan, Robert K. 1939-</dc:creator> >+ <dc:subject>Alphabet History.</dc:subject> >+ <dc:description>Includes bibliographical references (pages 247-255) and indexes</dc:description> >+ <dc:publisher>Cresskill, N.J. : Hampton Press,</dc:publisher> >+ <dc:type>Text</dc:type> >+ <dc:language>eng</dc:language> >+</oai_dc:dc> >+); >+ >+#OAI-DC Data >+ $xml_dc_record->get_xml_data({ >+ root => 'oai_dc:dc', >+ xsi_schemaLocation => 'http://www.openarchives.org/OAI/2.0/oai_dc/' . >+ ' http://www.openarchives.org/OAI/2.0/oai_dc.xsd', >+ entities => 0, >+ opt_namespace => 'oai_dc', >+ opt_namespace_url => 'http://www.openarchives.org/OAI/2.0/oai_dc/' >+ }); >+ >+ is ($xml_dc_record->write_xml(), $test4, "testing OAI-DC"); >+ >+#SRW-DC >+my $test5 = qq(<?xml version="1.0" encoding="utf-8"?> >+<srw_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/resources/dc-schema.xsd"> >+ <dc:title>The alphabet effect / Robert K. Logan.</dc:title> >+ <dc:creator>Logan, Robert K. 1939-</dc:creator> >+ <dc:subject>Alphabet History.</dc:subject> >+ <dc:description>Includes bibliographical references (pages 247-255) and indexes</dc:description> >+ <dc:publisher>Cresskill, N.J. : Hampton Press,</dc:publisher> >+ <dc:type>Text</dc:type> >+ <dc:language>eng</dc:language> >+</srw_dc:dc> >+); >+ >+# SRW-DC Data >+ $xml_dc_record->get_xml_data({ >+ root => 'srw_dc:dc', >+ xsi_schemaLocation => 'info:srw/schema/1/dc-schema' . >+ ' http://www.loc.gov/standards/sru/resources/dc-schema.xsd', >+ entities => 0, >+ opt_namespace => 'srw_dc', >+ opt_namespace_url => 'info:srw/schema/1/dc-schema' >+ }); >+ >+ is ($xml_dc_record->write_xml(), $test5, "testing SRW-DC"); >+ >+#Simple RDF-DC >+ $rdf_dc_record->get_rdf_data({ >+ rdf_subject => 'http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#', >+ rdf_format => 'rdfxml', >+ entities => 0 >+ }); >+ >+my $test6 = qq(<?xml version="1.0" encoding="utf-8"?> >+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> >+<rdf:Description rdf:about="http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#"> >+\t<dc:creator>Logan, Robert K. 1939-</dc:creator> >+\t<dc:description>Includes bibliographical references (pages 247-255) and indexes</dc:description> >+\t<dc:language>eng</dc:language> >+\t<dc:publisher>Cresskill, N.J. : Hampton Press,</dc:publisher> >+\t<dc:subject>Alphabet History.</dc:subject> >+\t<dc:title>The alphabet effect / Robert K. Logan.</dc:title> >+\t<dc:type>Text</dc:type> >+</rdf:Description> >+</rdf:RDF> >+); >+ >+ is ($rdf_dc_record->write_rdf(), $test6, "testing Simple RDF-DC"); >+ >+#RDF-DC (Recommendation)-rdfxml >+ >+my $test7 = qq(<?xml version="1.0" encoding="utf-8"?> >+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcam="http://purl.org/dc/dcam/" xmlns:dcterms="http://purl.org/dc/terms/"> >+<rdf:Description rdf:nodeID="DCMIType"> >+\t<dcam:memberOf rdf:resource="http://purl.org/dc/terms/DCMIType"/> >+\t<rdf:value>Text</rdf:value> >+</rdf:Description> >+<rdf:Description rdf:nodeID="LCSH"> >+\t<dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCSH"/> >+\t<rdf:value>Alphabet History.</rdf:value> >+</rdf:Description> >+<rdf:Description rdf:nodeID="language"> >+\t<dcam:memberOf rdf:resource="http://purl.org/dc/terms/ISO639-2"/> >+\t<rdf:value>eng</rdf:value> >+</rdf:Description> >+<rdf:Description rdf:about="http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#"> >+\t<dcterms:created>[2004]</dcterms:created> >+\t<dcterms:creator>Logan, Robert K. 1939-</dcterms:creator> >+\t<dcterms:description>Includes bibliographical references (pages 247-255) and indexes</dcterms:description> >+\t<dcterms:extent>xiv, 265 pages :</dcterms:extent> >+\t<dcterms:issued>2004</dcterms:issued> >+\t<dcterms:issued>[2004]</dcterms:issued> >+\t<dcterms:language rdf:nodeID="language"/> >+\t<dcterms:publisher>Cresskill, N.J. : Hampton Press,</dcterms:publisher> >+\t<dcterms:subject rdf:nodeID="LCSH"/> >+\t<dcterms:title>The alphabet effect / Robert K. Logan.</dcterms:title> >+\t<dcterms:type rdf:nodeID="DCMIType"/> >+</rdf:Description> >+</rdf:RDF> >+); >+ >+$rdf_dc_record->qualified(1); >+ >+ is ($rdf_dc_record->write_rdf(), $test7, "testing RDF-DC (Recommendation)"); >+ >+my $test8 = qq(\@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >+\@prefix dcterms: <http://purl.org/dc/terms/> . >+\@prefix dcam: <http://purl.org/dc/dcam/> . >+ >+_:DCMIType dcam:memberOf dcterms:DCMIType ; >+\trdf:value "Text" . >+_:LCSH dcam:memberOf dcterms:LCSH ; >+\trdf:value "Alphabet History." . >+_:language dcam:memberOf dcterms:ISO639-2 ; >+\trdf:value "eng" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> dcterms:created "[2004]" ; >+\tdcterms:creator "Logan, Robert K. 1939-" ; >+\tdcterms:description "Includes bibliographical references (pages 247-255) and indexes" ; >+\tdcterms:extent "xiv, 265 pages :" ; >+\tdcterms:issued "2004", "[2004]" ; >+\tdcterms:language _:language ; >+\tdcterms:publisher "Cresskill, N.J. : Hampton Press," ; >+\tdcterms:subject _:LCSH ; >+\tdcterms:title "The alphabet effect / Robert K. Logan." ; >+\tdcterms:type _:DCMIType . >+); >+ >+$rdf_dc_record->rdf_format('turtle'); >+ >+ is ($rdf_dc_record->write_rdf(), $test8, "testing RDF-DC (Recommendation) in turtle format"); >+ >+my $test9 = qq(_:DCMIType <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/DCMIType> . >+_:DCMIType <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "Text" . >+_:LCSH <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/LCSH> . >+_:LCSH <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "Alphabet History." . >+_:language <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/ISO639-2> . >+_:language <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "eng" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/created> "[2004]" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/creator> "Logan, Robert K. 1939-" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/description> "Includes bibliographical references (pages 247-255) and indexes" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/extent> "xiv, 265 pages :" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/issued> "2004" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/issued> "[2004]" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/language> _:language . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/publisher> "Cresskill, N.J. : Hampton Press," . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/subject> _:LCSH . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/title> "The alphabet effect / Robert K. Logan." . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/type> _:DCMIType . >+); >+ >+$rdf_dc_record->rdf_format('nquads'); >+ >+ is ($rdf_dc_record->write_rdf(), $test9, "testing RDF-DC (Recommendation) in nquads format"); >+ >+my $test10 = qq({"_:LCSH":{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[{"value":"Alphabet History.","type":"literal"}],"http://purl.org/dc/dcam/memberOf":[{"value":"http://purl.org/dc/terms/LCSH","type":"uri"}]},"http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#":{"http://purl.org/dc/terms/title":[{"value":"The alphabet effect / Robert K. Logan.","type":"literal"}],"http://purl.org/dc/terms/issued":[{"value":"2004","type":"literal"},{"value":"[2004]","type":"literal"}],"http://purl.org/dc/terms/type":[{"value":"_:DCMIType","type":"bnode"}],"http://purl.org/dc/terms/subject":[{"value":"_:LCSH","type":"bnode"}],"http://purl.org/dc/terms/description":[{"value":"Includes bibliographical references (pages 247-255) and indexes","type":"literal"}],"http://purl.org/dc/terms/publisher":[{"value":"Cresskill, N.J. : Hampton Press,","type":"literal"}],"http://purl.org/dc/terms/creator":[{"value":"Logan, Robert K. 1939-","type":"literal"}],"http://purl.org/dc/terms/language":[{"value":"_:language","type":"bnode"}],"http://purl.org/dc/terms/extent":[{"value":"xiv, 265 pages :","type":"literal"}],"http://purl.org/dc/terms/created":[{"value":"[2004]","type":"literal"}]},"_:language":{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[{"value":"eng","type":"literal"}],"http://purl.org/dc/dcam/memberOf":[{"value":"http://purl.org/dc/terms/ISO639-2","type":"uri"}]},"_:DCMIType":{"http://www.w3.org/1999/02/22-rdf-syntax-ns#value":[{"value":"Text","type":"literal"}],"http://purl.org/dc/dcam/memberOf":[{"value":"http://purl.org/dc/terms/DCMIType","type":"uri"}]}}); >+ >+$rdf_dc_record->rdf_format('rdfjson'); >+ >+ is ($rdf_dc_record->write_rdf(), $test10, "testing RDF-DC (Recommendation) in rdfjson format"); >+ >+my $test11 = qq(_:DCMIType <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/DCMIType> . >+_:DCMIType <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "Text" . >+_:LCSH <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/LCSH> . >+_:LCSH <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "Alphabet History." . >+_:language <http://purl.org/dc/dcam/memberOf> <http://purl.org/dc/terms/ISO639-2> . >+_:language <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "eng" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/created> "[2004]" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/creator> "Logan, Robert K. 1939-" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/description> "Includes bibliographical references (pages 247-255) and indexes" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/extent> "xiv, 265 pages :" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/issued> "2004" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/issued> "[2004]" . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/language> _:language . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/publisher> "Cresskill, N.J. : Hampton Press," . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/subject> _:LCSH . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/title> "The alphabet effect / Robert K. Logan." . >+<http://opac.mydomain.edu/cgi-bin/koha/opac-detail.pl?biblionumber=#> <http://purl.org/dc/terms/type> _:DCMIType . >+); >+ >+$rdf_dc_record->rdf_format('ntriples'); >+ >+ is ($rdf_dc_record->write_rdf(), $test11, "testing RDF-DC (Recommendation) in ntriples format"); >+ >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13642
:
35637
|
35638
|
35639
|
35640
|
35641
|
35642
|
35643
|
35644
|
35645
|
35663
|
35957
|
35981
|
35982
|
35983
|
35999
|
36000
|
36005
|
36006
|
36147
|
36154
|
36631
|
36632
|
36633
|
36636
|
36714
|
38220
|
38819
|
39623
|
39654
|
40786
|
40787
|
42168
|
43311
|
43313
|
43545
|
43548
|
43549
|
43586
|
43612
|
44627
|
44629
|
44658
|
44659
|
44660
|
44661
|
44662
|
44669
|
44672
|
44677
|
44727
|
44728
|
44729
|
44815
|
44816
|
44819
|
45970
|
45971
|
46514
|
46584
|
46585
|
46586
|
46587
|
46588