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:
Jonathan Druart 2026-05-11 10:39:27 +02:00 committed by Lucas Gass
parent 26abf4c73d
commit 4da822b6a1
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 7 additions and 3 deletions

View File

@ -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;