Lines 18-23
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
|
|
21 |
use Test::MockTime qw/set_fixed_time restore_time/; |
21 |
|
22 |
|
22 |
use Test::More tests => 29; |
23 |
use Test::More tests => 29; |
23 |
use DateTime; |
24 |
use DateTime; |
Lines 69-78
$dbh->do('DELETE FROM deletedbiblioitems');
Link Here
|
69 |
$dbh->do('DELETE FROM deleteditems'); |
70 |
$dbh->do('DELETE FROM deleteditems'); |
70 |
$dbh->do('DELETE FROM oai_sets'); |
71 |
$dbh->do('DELETE FROM oai_sets'); |
71 |
|
72 |
|
72 |
my $date_added = DateTime->now() . 'Z'; |
73 |
set_fixed_time(CORE::time()); |
|
|
74 |
|
75 |
my $base_datetime = DateTime->now(); |
76 |
my $date_added = $base_datetime->ymd . ' ' .$base_datetime->hms . 'Z'; |
73 |
my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; |
77 |
my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; |
74 |
my (@header, @marcxml, @oaidc); |
78 |
my (@header, @marcxml, @oaidc); |
75 |
my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'); |
79 |
my $sth = $dbh->prepare('UPDATE biblioitems SET timestamp=? WHERE biblionumber=?'); |
|
|
80 |
my $sth2 = $dbh->prepare('UPDATE biblio_metadata SET timestamp=? WHERE biblionumber=?'); |
76 |
|
81 |
|
77 |
# Add biblio records |
82 |
# Add biblio records |
78 |
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { |
83 |
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { |
Lines 85-92
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
Link Here
|
85 |
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); |
90 |
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); |
86 |
} |
91 |
} |
87 |
my ($biblionumber) = AddBiblio($record, ''); |
92 |
my ($biblionumber) = AddBiblio($record, ''); |
88 |
$sth->execute($biblionumber); |
93 |
my $timestamp = $base_datetime->ymd . ' ' .$base_datetime->hms; |
89 |
my $timestamp = $sth->fetchrow_array . 'Z'; |
94 |
$sth->execute($timestamp,$biblionumber); |
|
|
95 |
$sth2->execute($timestamp,$biblionumber); |
96 |
$timestamp .= 'Z'; |
90 |
$timestamp =~ s/ /T/; |
97 |
$timestamp =~ s/ /T/; |
91 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
98 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
92 |
$record = XMLin($record->as_xml_record); |
99 |
$record = XMLin($record->as_xml_record); |
Lines 341-346
test_query(
Link Here
|
341 |
}, |
348 |
}, |
342 |
}); |
349 |
}); |
343 |
|
350 |
|
|
|
351 |
restore_time(); |
352 |
|
344 |
subtest 'Bug 19725: OAI-PMH ListRecords and ListIdentifiers should use biblio_metadata.timestamp' => sub { |
353 |
subtest 'Bug 19725: OAI-PMH ListRecords and ListIdentifiers should use biblio_metadata.timestamp' => sub { |
345 |
plan tests => 1; |
354 |
plan tests => 1; |
346 |
|
355 |
|
347 |
- |
|
|