Bugzilla – Attachment 71422 Details for
Bug 20144
Test suite is failing with new default SQL modes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20144: [sql_modes] Correct quotes.timestamp values in tests
Bug-20144-sqlmodes-Correct-quotestimestamp-values-.patch (text/plain), 3.83 KB, created by
Julian Maurice
on 2018-02-12 10:10:52 UTC
(
hide
)
Description:
Bug 20144: [sql_modes] Correct quotes.timestamp values in tests
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-02-12 10:10:52 UTC
Size:
3.83 KB
patch
obsolete
>From 1d8b72d3e0dd58559f3647ecb1099eb393fd53c5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 5 Feb 2018 16:20:05 -0300 >Subject: [PATCH] Bug 20144: [sql_modes] Correct quotes.timestamp values in > tests > >Fix for: >Incorrect datetime value: '0000-00-00 00:00:00' for column 'timestamp' > >t/db_dependent/Koha/GetDailyQuote.t > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > t/db_dependent/Koha/GetDailyQuote.t | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/GetDailyQuote.t b/t/db_dependent/Koha/GetDailyQuote.t >index 08ec0bb08a..dea55bc5d9 100644 >--- a/t/db_dependent/Koha/GetDailyQuote.t >+++ b/t/db_dependent/Koha/GetDailyQuote.t >@@ -40,17 +40,17 @@ $dbh->do("DELETE FROM quotes"); > > # Ids not starting with 1 to reflect possible deletes, this acts as a regression test for bug 11297 > $dbh->do("INSERT INTO `quotes` VALUES >-(6,'George Washington','To be prepared for war is one of the most effectual means of preserving peace.','0000-00-00 00:00:00'), >-(7,'Thomas Jefferson','When angry, count ten, before you speak; if very angry, an hundred.','0000-00-00 00:00:00'), >-(8,'Abraham Lincoln','Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.','0000-00-00 00:00:00'), >-(9,'Abraham Lincoln','I have always found that mercy bears richer fruits than strict justice.','0000-00-00 00:00:00'), >-(10,'Andrew Johnson','I feel incompetent to perform duties...which have been so unexpectedly thrown upon me.','0000-00-00 00:00:00');"); >+(6,'George Washington','To be prepared for war is one of the most effectual means of preserving peace.',NOW()), >+(7,'Thomas Jefferson','When angry, count ten, before you speak; if very angry, an hundred.',NOW()), >+(8,'Abraham Lincoln','Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.',NOW()), >+(9,'Abraham Lincoln','I have always found that mercy bears richer fruits than strict justice.',NOW()), >+(10,'Andrew Johnson','I feel incompetent to perform duties...which have been so unexpectedly thrown upon me.',NOW());"); > > my $expected_quote = { > id => 8, > source => 'Abraham Lincoln', > text => 'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.', >- timestamp => '0000-00-00 00:00:00', >+ timestamp => dt_from_string, > }; > > my $quote = GetDailyQuote('id'=>8); >@@ -61,8 +61,7 @@ $quote = GetDailyQuote('random'=>1); > ok($quote, "Got a random quote."); > cmp_ok($quote->{'id'}, '>', 0, 'Id is greater than 0'); > >-$dbh->do("UPDATE quotes SET timestamp = '0000-00-00 00:00:00';"); >-my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string()); >+my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string->add( hours => 1 )); # To make it the last one > my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; > my $sth = C4::Context->dbh->prepare($query); > $sth->execute( $timestamp , $expected_quote->{'id'}); >@@ -79,7 +78,7 @@ $quote = eval {GetDailyQuote();}; > is( $@, '', 'GetDailyQuote does not die if no quote exist' ); > is_deeply( $quote, {}, 'GetDailyQuote return an empty hashref is no quote exist'); # Is it what we expect? > $dbh->do(q|INSERT INTO `quotes` VALUES >- (6,'George Washington','To be prepared for war is one of the most effectual means of preserving peace.','0000-00-00 00:00:00') >+ (6,'George Washington','To be prepared for war is one of the most effectual means of preserving peace.',NOW()) > |); > > $quote = GetDailyQuote(); >-- >2.14.2
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 20144
:
71410
|
71411
|
71412
|
71413
|
71414
|
71415
|
71416
|
71417
|
71418
|
71419
|
71420
|
71421
| 71422 |
71423
|
71424
|
71425
|
71427
|
71428
|
71429
|
71430
|
71431
|
71432
|
71434
|
71435
|
71436
|
71437
|
71438
|
71440
|
71441
|
71442
|
71443
|
71444
|
71445
|
71446
|
71447
|
71448
|
71449
|
71450
|
71451
|
71452
|
71453
|
71454
|
71455
|
71456
|
71457
|
71458
|
71459
|
71460
|
71461
|
71462
|
71463
|
71467
|
71564