Bug 18501: (follow-up) Use t::lib::Dates::compare in tests
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 21 Aug 2020 09:21:35 +0000 (10:21 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Aug 2020 09:51:20 +0000 (11:51 +0200)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Koha/Items.t

index 6140139..bd2b6b0 100644 (file)
@@ -118,13 +118,15 @@ subtest 'store' => sub {
             Time::Fake->offset( $yesterday->epoch );
             $item->$field(1)->store;
             $item->get_from_storage;
-            is($item->$field_on, DateTime::Format::MySQL->format_datetime($yesterday), $field_on . " was set upon first truthy setting");
+            is( t::lib::Dates::compare( $item->$field_on, $yesterday ),
+                0, $field_on . " was set upon first truthy setting" );
 
             # Update the field to a new 'true' value
             Time::Fake->offset( $today->epoch );
             $item->$field(2)->store;
             $item->get_from_storage;
-            is($item->$field_on, DateTime::Format::MySQL->format_datetime($yesterday), $field_on . " was not updated upon second truthy setting");
+            is( t::lib::Dates::compare( $item->$field_on, $yesterday ),
+                0, $field_on . " was not updated upon second truthy setting" );
 
             # Update the field to a new 'false' value
             $item->$field(0)->store;