Bug 42578: Prevent Koha/Hold.t to fail on date comparison
We must use t::lib::Dates::compare to compare dates in test. Test plan: Confirm that `prove t/db_dependent/Koha/Hold.t` still returns green after this patch Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
26abf4c73d
commit
4da822b6a1
|
|
@ -27,7 +27,7 @@ use Test::MockModule;
|
|||
|
||||
use t::lib::Mocks;
|
||||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
use t::lib::Dates;
|
||||
|
||||
use C4::Reserves qw(AddReserve);
|
||||
|
||||
|
|
@ -1404,8 +1404,12 @@ subtest 'revert_found() tests' => sub {
|
|||
|
||||
my $log =
|
||||
Koha::ActionLogs->search( { module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id } )->next;
|
||||
my $expected = sprintf q{'timestamp' => '%s'}, $hold->timestamp;
|
||||
like( $log->info, qr{$expected}, 'Timestamp logged is the current one' );
|
||||
if ( $log && $log->info =~ m{'timestamp' => '([^']*)'} ) {
|
||||
my $timestamp = $1;
|
||||
is( t::lib::Dates::compare( $timestamp, $hold->timestamp ), 0, 'Timestamp logged is the current one' );
|
||||
} else {
|
||||
fail('Log entry for hold modification not found or malformed');
|
||||
}
|
||||
my $log_count =
|
||||
Koha::ActionLogs->search( { module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id } )->count;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue