Skip to content

Commit

Permalink
Initialize Time::$defaultLocale to 'en_US' during tests.
Browse files Browse the repository at this point in the history
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 f63da3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/TestCase/Utility/TimeTest.php
Expand Up @@ -34,6 +34,7 @@ public function setUp() {
parent::setUp();
$this->now = Time::getTestNow();
$this->locale = Time::$defaultLocale;
Time::$defaultLocale = 'en_US';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/View/Helper/TimeHelperTest.php
@@ -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)
*
Expand All @@ -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;

Expand All @@ -40,6 +39,7 @@ public function setUp() {
parent::setUp();
$this->View = new View();
$this->Time = new TimeHelper($this->View);
Time::$defaultLocale = 'en_US';
}

/**
Expand Down

0 comments on commit f63da3c

Please sign in to comment.