Skip to content
Permalink
Browse files

Initialize Time::$defaultLocale to 'en_US' during tests.

The standard datetime formats used by IntDateFormatter are locale dependent.
This change prevents failures when tests are run in an environment where default
locale is not 'en_US'.
  • Loading branch information...
ADmad committed Jul 10, 2014
1 parent 2ae1fd9 commit f63da3c4c640b7d8e023499e86437522d16e6e43
Showing with 3 additions and 2 deletions.
  1. +1 −0 tests/TestCase/Utility/TimeTest.php
  2. +2 −2 tests/TestCase/View/Helper/TimeHelperTest.php
@@ -34,6 +34,7 @@ public function setUp() {
parent::setUp();
$this->now = Time::getTestNow();
$this->locale = Time::$defaultLocale;
Time::$defaultLocale = 'en_US';
}
/**
@@ -1,7 +1,5 @@
<?php
/**
* TimeHelperTest file
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -20,6 +18,7 @@
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\TestSuite\TestCase;
use Cake\Utility\Time;
use Cake\View\Helper\TimeHelper;
use Cake\View\View;
@@ -40,6 +39,7 @@ public function setUp() {
parent::setUp();
$this->View = new View();
$this->Time = new TimeHelper($this->View);
Time::$defaultLocale = 'en_US';
}
/**

0 comments on commit f63da3c

Please sign in to comment.
You can’t perform that action at this time.