Bug 20144: [sql_modes] Correct quotes.timestamp values in tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 5 Feb 2018 21:23:59 +0000 (18:23 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 13 Feb 2018 16:58:54 +0000 (13:58 -0300)
Fix for:
Incorrect datetime value: '0000-00-00 00:00:00' for column 'timestamp'

t/db_dependent/Koha.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha.t

index 64bb045..4e814a0 100644 (file)
@@ -173,15 +173,15 @@ SKIP:
 # Fill the quote table with the default needed and a spare
 $dbh->do("DELETE FROM quotes WHERE id=3 OR id=25;");
 my $sql = "INSERT INTO quotes (id,source,text,timestamp) VALUES
-(25,'Richard Nixon','When the President does it, that means that it is not illegal.','0000-00-00 00:00:00'),
-(3,'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');";
+(25,'Richard Nixon','When the President does it, that means that it is not illegal.',NOW()),
+(3,'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());";
 $dbh->do($sql);
 
                 my $expected_quote = {
                     id          => 3,
                     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   => re('\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}'),   #'0000-00-00 00:00:00',
+                    timestamp   => re('\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}'),   #'YYYY-MM-DD HH:MM:SS'
                 };
 
 # test quote retrieval based on id