From 0776fc986bd4ecf5c93d0adcf471b67e99537886 Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Mon, 9 Nov 2015 17:17:28 -0600 Subject: [PATCH] Bug 13642 - Add Unit test for C4::Record::marc2dcxml Add Unit test for C4::Record::marc2dcxml To test: Prove t/db_dependent/Record.t --- t/db_dependent/Record.t | 55 ++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/t/db_dependent/Record.t b/t/db_dependent/Record.t index 8e806d7..8ad07fd 100755 --- a/t/db_dependent/Record.t +++ b/t/db_dependent/Record.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 12; +use Test::More tests => 13; use MARC::Record; use C4::Context; @@ -50,32 +50,37 @@ is ($marcxml, $testxml, "testing marc2xml"); my $marcconvert=marcxml2marc($marcxml); is ($marcconvert->as_xml,$marc->as_xml, "testing xml2marc"); -my $marcdc=marc2dcxml($marc); +my $marcsrwdc=marc2dcxml( $marc, undef, undef, "srwdc" ); my $test2xml=qq( - -); + + + +); -is ($marcdc, $test2xml, "testing marc2dcxml"); +is ($marcsrwdc, $test2xml, "testing SRWDC Metadata"); -my $marcqualified=marc2dcxml($marc,1); +my $marcoaidc=marc2dcxml( $marc, undef, undef, "oaidc" ); my $test3xml=qq( - -); + + + + +); -is ($marcqualified, $test3xml, "testing marcQualified"); +is ($marcoaidc, $test3xml, "testing OAIDC Metadata"); -my $mods=marc2modsxml($marc); +my $marcrdfdc=marc2dcxml( $marc, undef, undef, "rdfdc" ); my $test4xml=qq( + + + + +); + +is ($marcrdfdc, $test4xml, "testing OAIDC Metadata"); + +my $mods=marc2modsxml($marc); +my $test5xml=qq( @@ -85,7 +90,7 @@ my $test4xml=qq( ); -is ($mods, $test4xml, "testing marc2modsxml"); +is ($mods, $test5xml, "testing marc2modsxml"); $marc->append_fields(MARC::Field->new( '100', ' ', ' ', a => 'Rowling, J.K.' @@ -100,7 +105,7 @@ $marc->append_fields(MARC::Field->new( #print $endnote; my $bibtex=marc2bibtex($marc, 'testID'); -my $test5xml=qq(\@book{testID, +my $test6xml=qq(\@book{testID, author = {Rowling, J.K.}, title = {Harry potter}, publisher = {Scholastic}, @@ -108,11 +113,11 @@ my $test5xml=qq(\@book{testID, } ); -is ($bibtex, $test5xml, "testing bibtex"); +is ($bibtex, $test6xml, "testing bibtex"); C4::Context->set_preference( "BibtexExportAdditionalFields", "'\@': 260\$b\ntest: 260\$b" ); $bibtex = marc2bibtex( $marc, 'testID' ); -my $test6xml = qq(\@Scholastic{testID, +my $test7xml = qq(\@Scholastic{testID, \tauthor = {Rowling, J.K.}, \ttitle = {Harry potter}, \tpublisher = {Scholastic}, @@ -120,7 +125,7 @@ my $test6xml = qq(\@Scholastic{testID, \ttest = {Scholastic} } ); -is( $bibtex, $test6xml, "testing bibtex" ); +is( $bibtex, $test7xml, "testing bibtex" ); C4::Context->set_preference( "BibtexExportAdditionalFields", q{} ); $marc->append_fields(MARC::Field->new( -- 1.7.10.4