Bugzilla – Attachment 33564 Details for
Bug 13242
Slow checkin for patrons restricted indefinitely
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13242: Add a UT to t/DateUtils.t for testing DateTime bug
Bug-13242-Add-a-UT-to-tDateUtilst-for-testing-Date.patch (text/plain), 2.23 KB, created by
Jonathan Druart
on 2014-11-14 11:08:39 UTC
(
hide
)
Description:
Bug 13242: Add a UT to t/DateUtils.t for testing DateTime bug
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-11-14 11:08:39 UTC
Size:
2.23 KB
patch
obsolete
>From d88ac9fd1e775d258812375630120b8c7738c56e Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Fri, 14 Nov 2014 11:19:17 +0100 >Subject: [PATCH] Bug 13242: Add a UT to t/DateUtils.t for testing DateTime bug > >A bug in DateTime slow down drastically date parsing when the dates are in the >far distant future: > >https://metacpan.org/pod/DateTime#Determining-the-Local-Time-Zone-Can-Be-Slow > >This UT tests this situation. > >TO TEST: >- Apply the patch containing the UT >- prove -v t/DateUtils.t >- You see that parsing a 9999-01-01 that take forever (ie more than 1s) >- Apply Jonathan patch >- prove -v t/DateUtils.t >- No more complain. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/DateUtils.t | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/t/DateUtils.t b/t/DateUtils.t >index 9afddc1..cc8cefa 100755 >--- a/t/DateUtils.t >+++ b/t/DateUtils.t >@@ -5,8 +5,9 @@ use DateTime; > use DateTime::TimeZone; > > use C4::Context; >-use Test::More tests => 34; >+use Test::More tests => 37; > use Test::MockModule; >+use Time::HiRes qw/ gettimeofday /; > > BEGIN { use_ok('Koha::DateUtils'); } > >@@ -77,6 +78,13 @@ isa_ok( $new_dt, 'DateTime', 'Create DateTime with different timezone' ); > cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, > 'Returned Dublin object matches input' ); > >+for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) { >+ my $duration = gettimeofday(); >+ $new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin); >+ $duration = gettimeofday() - $duration; >+ cmp_ok $duration, '<', 1, "Create DateTime $_ with TZ in less than 1s"; >+} >+ > $new_dt = dt_from_string( '2011-06-16 12:00', 'sql' ); > isa_ok( $new_dt, 'DateTime', 'Create DateTime from (mysql) sql' ); > cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, 'sql returns correct date' ); >@@ -145,3 +153,5 @@ $date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '2 > cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)'; > $date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 }); > cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)'; >+ >+ >-- >2.1.0
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 13242
:
33510
|
33511
|
33560
|
33561
|
33564
|
33565
|
33589
|
33590
|
33591
|
33592
|
33596
|
33597
|
33945