Bugzilla – Attachment 126184 Details for
Bug 24850
Koha::DateUtils ignores offsets in RFC3339 datetimes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24850: Add tests for invalid RFC3339 dates
Bug-24850-Add-tests-for-invalid-RFC3339-dates.patch (text/plain), 1.43 KB, created by
Martin Renvoize (ashimema)
on 2021-10-13 12:38:35 UTC
(
hide
)
Description:
Bug 24850: Add tests for invalid RFC3339 dates
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-13 12:38:35 UTC
Size:
1.43 KB
patch
obsolete
>From 9fd96201613b5c8bde4f5747f7a018226254c12f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 11 Mar 2020 16:20:36 +0000 >Subject: [PATCH] Bug 24850: Add tests for invalid RFC3339 dates > >We should die on invalidly formatted dates being passed. This patch >adds such a test case. > >Signed-off-by: David Cook <dcook@prosentient.com.au> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/DateUtils.t | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > >diff --git a/t/DateUtils.t b/t/DateUtils.t >index 4d56d820f2..97daa555bf 100755 >--- a/t/DateUtils.t >+++ b/t/DateUtils.t >@@ -4,7 +4,7 @@ use DateTime::TimeZone; > > use C4::Context; > >-use Test::More tests => 78; >+use Test::More tests => 79; > > use Test::MockModule; > use Test::Warn; >@@ -137,6 +137,13 @@ cmp_ok( $dt0->epoch(), 'eq', '1325462399', 'dt_from_string handles seconds with > $dt0 = dt_from_string( '2012-01-01T23:59:59.999+02:00', 'rfc3339' ); > cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with 3 decimal places and a timezone' ); > >+try { >+ $dt0 = dt_from_string( '2012-01-01T23:59:59.999Z+02:00', 'rfc3339' ); >+} >+catch { >+ like( $_, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); >+}; >+ > # Return undef if passed mysql 0 dates > $dt0 = dt_from_string( '0000-00-00', 'iso' ); > is( $dt0, undef, "undefined returned for 0 iso date" ); >-- >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 24850
:
100585
|
100586
|
100587
|
100592
|
100593
|
100594
|
100595
|
100678
|
100679
|
100680
|
100681
|
100881
|
100901
|
100902
|
100903
|
100904
|
100905
|
101803
|
101804
|
101805
|
101806
|
101807
|
101808
|
101837
|
101838
|
101839
|
101840
|
101841
|
101842
|
101843
|
101844
|
115851
|
115852
|
115853
|
115854
|
115855
|
115856
|
115857
|
116299
|
116300
|
116301
|
116302
|
116303
|
116304
|
116305
|
116355
|
116356
|
116357
|
116358
|
116359
|
116360
|
116361
|
116511
|
126182
|
126183
| 126184 |
126185
|
126186
|
126187
|
126188
|
126189
|
127231
|
127232
|
127235
|
127236
|
127239
|
127240
|
127241
|
127242
|
127243
|
127244