Bugzilla – Attachment 69530 Details for
Bug 19353
Make possible to have custom XSL template for marcxml and marc21 metadata prefixes in OAI server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19353: Add test
Bug-19353-Add-test.patch (text/plain), 3.93 KB, created by
Josef Moravec
on 2017-12-05 17:06:33 UTC
(
hide
)
Description:
Bug 19353: Add test
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-12-05 17:06:33 UTC
Size:
3.93 KB
patch
obsolete
>From 098b8e6c89e458d902e8ab03a41ad8143e2d5754 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 4 Dec 2017 02:10:31 +0000 >Subject: [PATCH] Bug 19353: Add test > >--- > t/db_dependent/OAI/Server.t | 31 +++++++++++++++++++++++++++++-- > t/db_dependent/OAI/oaiconf.yaml | 7 +++++++ > 2 files changed, 36 insertions(+), 2 deletions(-) > create mode 100644 t/db_dependent/OAI/oaiconf.yaml > >diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t >index 951d7b0..6f6ab1a 100644 >--- a/t/db_dependent/OAI/Server.t >+++ b/t/db_dependent/OAI/Server.t >@@ -19,8 +19,10 @@ > > use Modern::Perl; > >-use Test::More tests => 28; >+use Test::More tests => 29; > use DateTime; >+use File::Basename; >+use File::Spec; > use Test::MockModule; > use Test::Warn; > use XML::Simple; >@@ -68,7 +70,7 @@ $dbh->do('DELETE FROM oai_sets'); > > my $date_added = DateTime->now() . 'Z'; > my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; >-my (@header, @marcxml, @oaidc); >+my (@header, @marcxml, @oaidc, @marcxml_transformed); > my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'); > > # Add biblio records >@@ -77,9 +79,11 @@ foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { > if (C4::Context->preference('marcflavour') eq 'UNIMARC') { > $record->append_fields( MARC::Field->new('101', '', '', 'a' => "lng" ) ); > $record->append_fields( MARC::Field->new('200', '', '', 'a' => "Title $index" ) ); >+ $record->append_fields( MARC::Field->new('995', '', '', 'a' => "Code" ) ); > } else { > $record->append_fields( MARC::Field->new('008', ' lng' ) ); > $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); >+ $record->append_fields( MARC::Field->new('995', '', '', 'a' => "Code" ) ); > } > my ($biblionumber) = AddBiblio($record, ''); > $sth->execute($biblionumber); >@@ -87,6 +91,9 @@ foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { > $timestamp =~ s/ /T/; > $timestamp = manipulate_timestamp( $index, $biblionumber, $timestamp ); > $record = GetMarcBiblio({ biblionumber => $biblionumber }); >+ my $record_transformed = $record->clone; >+ $record_transformed->delete_fields( $record_transformed->field('995')); >+ $record_transformed = XMLin($record_transformed->as_xml_record); > $record = XMLin($record->as_xml_record); > push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; > push @oaidc, { >@@ -109,6 +116,13 @@ foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { > record => $record, > }, > }; >+ >+ push @marcxml_transformed, { >+ header => $header[$index], >+ metadata => { >+ record => $record_transformed, >+ }, >+ }; > } > > my $syspref = { >@@ -335,6 +349,19 @@ test_query( > }, > }); > >+# List records, but now transformed by XSLT >+t::lib::Mocks::mock_preference("OAI-PMH:ConfFile" => File::Spec->rel2abs(dirname(__FILE__)) . "/oaiconf.yaml"); >+test_query('ListRecords marcxml with xsl transformation', >+ { verb => 'ListRecords', metadataPrefix => 'marcxml' }, >+ { ListRecords => { >+ record => [ @marcxml_transformed[0..2] ], >+ resumptionToken => { >+ content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0/0", >+ cursor => 3, >+ } >+ }, >+}); >+ > $schema->storage->txn_rollback; > > sub manipulate_timestamp { >diff --git a/t/db_dependent/OAI/oaiconf.yaml b/t/db_dependent/OAI/oaiconf.yaml >new file mode 100644 >index 0000000..6d77f82 >--- /dev/null >+++ b/t/db_dependent/OAI/oaiconf.yaml >@@ -0,0 +1,7 @@ >+format: >+ marcxml: >+ metadataPrefix: marxml >+ metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim >+ schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd >+ xsl_file: /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/xslt/Del995.xsl >+ include_items: 0 >-- >2.1.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 19353
:
69530
|
69531
|
72553
|
72554
|
76331
|
76332
|
77469
|
77470
|
111005
|
111006
|
111007
|
111009
|
111524
|
111525
|
111526
|
111527