Permalink
Browse files

Making tests more robust to timezone differences

  • Loading branch information...
1 parent 5cdd8ac commit ae2127e23054cf1d6d049a23adbcc8e0aea753c5 @lorenzo lorenzo committed Jan 15, 2014
Showing with 4 additions and 1 deletion.
  1. +1 −0 Test/TestCase/Database/QueryTest.php
  2. +3 −1 Test/init.php
@@ -1923,6 +1923,7 @@ function($q) {
$result = $query
->select(['d' => $query->func()->now('time')])
->execute();
+
$this->assertWithinMargin(
date('U'),
(new \DateTime($result->fetchAll('assoc')[0]['d']))->format('U'),
View
@@ -59,6 +59,7 @@
require CORE_PATH . 'Cake/bootstrap.php';
+date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
Configure::write('debug', 2);
@@ -98,7 +99,8 @@
'dsn' => getenv('db_dsn'),
'database' => getenv('db_database'),
'login' => getenv('db_login'),
- 'password' => getenv('db_password')
+ 'password' => getenv('db_password'),
+ 'timezone' => 'UTC'
]);
Configure::write('Session', [

0 comments on commit ae2127e

Please sign in to comment.