From 3d5ed88593eb7a54ea95e02f22108a8efe4abff9 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Wed, 3 Nov 2021 13:41:44 +0000
Subject: [PATCH] Bug 29403: Fix api/v1/patrons.t

t::lib::Dates::compare expects either correct DateTime objects, or a
system formatted datetime strings to be passed.. but as we're testing
the API, we are consistently using RFC3339 strings for date-times and
ISO8601 strings for dates.  We need to therefore pre-process the strings
into DateTime objects for the comparison.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 t/db_dependent/api/v1/patrons.t | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t
index b7e65dc91cd..f5e0a324fe2 100755
--- a/t/db_dependent/api/v1/patrons.t
+++ b/t/db_dependent/api/v1/patrons.t
@@ -659,7 +659,11 @@ subtest 'update() tests' => sub {
         my $updated_on_got = delete $got->{updated_on};
         my $updated_on_expected = delete $newpatron->{updated_on};
         is_deeply($got, $newpatron, 'Returned patron from update matches expected');
-        t::lib::Dates::compare( $updated_on_got, $updated_on_expected, 'updated_on values matched' );
+        t::lib::Dates::compare(
+            dt_from_string( $updated_on_got,      'rfc3339' ),
+            dt_from_string( $updated_on_expected, 'rfc3339' ),
+            'updated_on values matched'
+        );
 
         is(Koha::Patrons->find( $patron_2->id )->cardnumber,
            $newpatron->{ cardnumber }, 'Patron is really updated!');
-- 
2.25.1