Bugzilla – Attachment 129389 Details for
Bug 29718
DateTime - our 'iso' is not ISO 8601
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29718: Mock the timezone
Bug-29718-Mock-the-timezone.patch (text/plain), 2.14 KB, created by
Martin Renvoize (ashimema)
on 2022-01-13 09:10:19 UTC
(
hide
)
Description:
Bug 29718: Mock the timezone
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-01-13 09:10:19 UTC
Size:
2.14 KB
patch
obsolete
>From ea66ea846344f06cdddc214dba58168bb7d57ecf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 13 Jan 2022 06:58:18 +0100 >Subject: [PATCH] Bug 29718: Mock the timezone > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/DateUtils.t | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > >diff --git a/t/DateUtils.t b/t/DateUtils.t >index d466a4a013..96d9ed27b2 100755 >--- a/t/DateUtils.t >+++ b/t/DateUtils.t >@@ -4,7 +4,7 @@ use DateTime::TimeZone; > > use C4::Context; > >-use Test::More tests => 79; >+use Test::More tests => 80; > > use Test::MockModule; > use Test::Warn; >@@ -146,9 +146,17 @@ like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string sh > subtest 'dt_from_string - iso format' => sub { > plan tests => 6; > >+ my $module_context = Test::MockModule->new('C4::Context'); >+ $module_context->mock( >+ 'tz', >+ sub { >+ return DateTime::TimeZone->new( name => 'Europe/Paris' ); >+ } >+ ); >+ > # Dateonly > my $dt_iso = dt_from_string( '2012-01-01', 'iso' ); >- cmp_ok( $dt_iso->epoch(), 'eq', '1325376000', 'dt_from_string handles dateonly string' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325372400', 'dt_from_string handles dateonly string' ); > > eval { > $dt_iso = dt_from_string( '2012-01-32', 'iso' ); >@@ -157,11 +165,11 @@ subtest 'dt_from_string - iso format' => sub { > > # Datetime > $dt_iso = dt_from_string( '2012-01-01T23:59:59', 'iso' ); >- cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with no offset assumes "local"' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325458799', 'dt_from_string with no offset assumes "local"' ); > > # Datetime with timezone > $dt_iso = dt_from_string( '2012-01-01T23:59:59Z', 'iso' ); >- cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with UTC prescribed as Z' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325462399', 'dt_from_string with UTC prescribed as Z' ); > > $dt_iso = dt_from_string( '2012-01-01T23:59:59+02:00', 'iso' ); > cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset' ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29718
:
128631
|
128653
|
128654
|
128658
|
128840
|
129372
|
129385
|
129386
|
129387
|
129388
|
129389
|
129390
|
129465
|
129466
|
129467
|
129468
|
129469
|
129470
|
129471