CRM-14423 - CiviUnitTestCase - UnitTest UF should set MySQL TZ (like Drupal/WP)
authorTim Otten <totten@civicrm.org>
Thu, 26 Feb 2015 02:11:45 +0000 (19:11 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 26 Feb 2015 02:11:45 +0000 (19:11 -0700)
tests/phpunit/CiviTest/CiviUnitTestCase.php

index 382d2310587d9bb28a2c18e1907894b5fd9d0848..35402a16a7e6dc8ddbd18d1cddf938e3259d2e3e 100644 (file)
@@ -316,9 +316,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
 
     // also set this global hack
     $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
-
-    $env = new CRM_Utils_Check_Env();
-    CRM_Utils_Check::singleton()->assertValid($env->checkMysqlTime());
   }
 
   /**
@@ -366,6 +363,11 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     // reset all the caches
     CRM_Utils_System::flushCache();
 
+    // Make sure the DB connection is setup properly
+    $config->userSystem->setMySQLTimeZone();
+    $env = new CRM_Utils_Check_Env();
+    CRM_Utils_Check::singleton()->assertValid($env->checkMysqlTime());
+
     // clear permissions stub to not check permissions
     $config = CRM_Core_Config::singleton();
     $config->userPermissionClass->permissions = NULL;