From 4fb1083f3981b81ae0edc961b98db86da6bb3d27 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 15 Feb 2018 14:14:18 -0300 Subject: [PATCH] Bug 20191: Make OAI/Server.t tests use timestamps from the DB Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/OAI/Server.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t index def867bffe..be56bc3b0a 100644 --- a/t/db_dependent/OAI/Server.t +++ b/t/db_dependent/OAI/Server.t @@ -30,7 +30,10 @@ use t::lib::Mocks; use C4::Biblio; use C4::Context; + +use Koha::Biblio::Metadatas; use Koha::Database; +use Koha::DateUtils; BEGIN { use_ok('Koha::OAI::Server::DeletedRecord'); @@ -344,14 +347,15 @@ subtest 'Bug 19725: OAI-PMH ListRecords and ListIdentifiers should use biblio_me # Wait 1 second to be sure no timestamp will be equal to $from defined below sleep 1; - my $from_dt = DateTime->now; - my $from = $from_dt->ymd . 'T' . $from_dt->hms . 'Z'; - # Modify record to trigger auto update of timestamp (my $biblionumber = $marcxml[0]->{header}->{identifier}) =~ s/^.*:(.*)/$1/; my $record = GetMarcBiblio({biblionumber => $biblionumber}); $record->append_fields(MARC::Field->new(999, '', '', z => '_')); - ModBiblio($record, $biblionumber); + ModBiblio( $record, $biblionumber ); + my $from_dt = dt_from_string( + Koha::Biblio::Metadatas->search({ biblionumber => $biblionumber }) + ->next->timestamp ); + my $from = $from_dt->ymd . 'T' . $from_dt->hms . 'Z'; $oaidc[0]->{header}->{datestamp} = $from; test_query( -- 2.14.1