Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 28; |
22 |
use Test::More tests => 29; |
23 |
use DateTime; |
23 |
use DateTime; |
24 |
use Test::MockModule; |
24 |
use Test::MockModule; |
25 |
use Test::Warn; |
25 |
use Test::Warn; |
Lines 89-106
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
Link Here
|
89 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
89 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
90 |
$record = XMLin($record->as_xml_record); |
90 |
$record = XMLin($record->as_xml_record); |
91 |
push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; |
91 |
push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; |
|
|
92 |
my $dc = { |
93 |
'dc:title' => "Title $index", |
94 |
'dc:language' => "lng", |
95 |
'dc:type' => {}, |
96 |
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
97 |
'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', |
98 |
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', |
99 |
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd', |
100 |
}; |
101 |
if (C4::Context->preference('marcflavour') eq 'UNIMARC') { |
102 |
$dc->{'dc:identifier'} = $biblionumber; |
103 |
} |
92 |
push @oaidc, { |
104 |
push @oaidc, { |
93 |
header => $header[$index], |
105 |
header => $header[$index], |
94 |
metadata => { |
106 |
metadata => { |
95 |
'oai_dc:dc' => { |
107 |
'oai_dc:dc' => $dc, |
96 |
'dc:title' => "Title $index", |
|
|
97 |
'dc:language' => "lng", |
98 |
'dc:type' => {}, |
99 |
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
100 |
'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', |
101 |
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', |
102 |
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd', |
103 |
}, |
104 |
}, |
108 |
}, |
105 |
}; |
109 |
}; |
106 |
push @marcxml, { |
110 |
push @marcxml, { |
Lines 335-340
test_query(
Link Here
|
335 |
}, |
339 |
}, |
336 |
}); |
340 |
}); |
337 |
|
341 |
|
|
|
342 |
subtest 'Bug 19725: OAI-PMH ListRecords and ListIdentifiers should use biblio_metadata.timestamp' => sub { |
343 |
plan tests => 1; |
344 |
|
345 |
# Wait 1 second to be sure no timestamp will be equal to $from defined below |
346 |
sleep 1; |
347 |
|
348 |
my $from_dt = DateTime->now; |
349 |
my $from = $from_dt->ymd . 'T' . $from_dt->hms . 'Z'; |
350 |
|
351 |
# Modify record to trigger auto update of timestamp |
352 |
(my $biblionumber = $marcxml[0]->{header}->{identifier}) =~ s/^.*:(.*)/$1/; |
353 |
my $record = GetMarcBiblio({biblionumber => $biblionumber}); |
354 |
$record->append_fields(MARC::Field->new(999, '', '', z => '_')); |
355 |
ModBiblio($record, $biblionumber); |
356 |
|
357 |
test_query( |
358 |
'ListRecords oai_dc with parameter from', |
359 |
{ verb => 'ListRecords', metadataPrefix => 'oai_dc', from => $from }, |
360 |
{ ListRecords => { |
361 |
record => $oaidc[0], |
362 |
}, |
363 |
}); |
364 |
}; |
365 |
|
338 |
$schema->storage->txn_rollback; |
366 |
$schema->storage->txn_rollback; |
339 |
|
367 |
|
340 |
sub manipulate_timestamp { |
368 |
sub manipulate_timestamp { |
341 |
- |
|
|