Merge remote-tracking branch 'origin/2.1' into 2.2

This commit is contained in:
Jose Lorenzo Rodriguez 2012-06-19 19:28:20 -04:30
commit 03d31b57f7
4 changed files with 18 additions and 13 deletions

View file

@ -347,8 +347,8 @@ class PostgresTest extends CakeTestCase {
* @return void
*/
public function testLocalizedFloats() {
$restore = setlocale(LC_ALL, 0);
setlocale(LC_ALL, 'de_DE');
$restore = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'de_DE');
$result = $this->db->value(3.141593, 'float');
$this->assertEquals("3.141593", $result);
@ -356,7 +356,7 @@ class PostgresTest extends CakeTestCase {
$result = $this->db->value(3.14);
$this->assertEquals("3.140000", $result);
setlocale(LC_ALL, $restore);
setlocale(LC_NUMERIC, $restore);
}
/**

View file

@ -6349,8 +6349,8 @@ class ModelWriteTest extends BaseModelTest {
* @return void
*/
public function testWriteFloatAsGerman() {
$restore = setlocale(LC_ALL, 0);
setlocale(LC_ALL, 'de_DE');
$restore = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'de_DE');
$model = new DataTest();
$result = $model->save(array(
@ -6358,7 +6358,7 @@ class ModelWriteTest extends BaseModelTest {
'float' => 3.14593
));
$this->assertTrue((bool)$result);
setlocale(LC_ALL, $restore);
setlocale(LC_NUMERIC, $restore);
}
/**

View file

@ -490,14 +490,14 @@ class CakeNumberTest extends CakeTestCase {
* @return void
*/
public function testReadableSizeLocalized() {
$restore = setlocale(LC_ALL, 0);
setlocale(LC_ALL, 'de_DE');
$restore = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'de_DE');
$result = $this->Number->toReadableSize(1321205);
$this->assertRegExp('/1[,.]26 MB/', $result);
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
$this->assertRegExp('/512[,.]00 GB/', $result);
setlocale(LC_ALL, $restore);
setlocale(LC_NUMERIC, $restore);
}
/**

View file

@ -103,8 +103,11 @@ class ValidationTest extends CakeTestCase {
public function setUp() {
parent::setUp();
$this->_appEncoding = Configure::read('App.encoding');
$this->_appLocale = setlocale(LC_ALL, "0");
setlocale(LC_ALL, 'en_US');
$this->_appLocale = array();
foreach (array(LC_MONETARY, LC_NUMERIC, LC_TIME) as $category) {
$this->_appLocale[$category] = setlocale($category, 0);
setlocale($category, 'en_US');
}
}
/**
@ -115,7 +118,9 @@ class ValidationTest extends CakeTestCase {
public function tearDown() {
parent::tearDown();
Configure::write('App.encoding', $this->_appEncoding);
setlocale(LC_ALL, $this->_appLocale);
foreach ($this->_appLocale as $category => $locale) {
setlocale($category, $locale);
}
}
/**