File tree Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -347,16 +347,16 @@ public function testValueQuoting() {
347
347
* @return void
348
348
*/
349
349
public function testLocalizedFloats () {
350
- $ restore = setlocale (LC_ALL , 0 );
351
- setlocale (LC_ALL , 'de_DE ' );
350
+ $ restore = setlocale (LC_NUMERIC , 0 );
351
+ setlocale (LC_NUMERIC , 'de_DE ' );
352
352
353
353
$ result = $ this ->db ->value (3.141593 , 'float ' );
354
354
$ this ->assertEquals ("3.141593 " , $ result );
355
355
356
356
$ result = $ this ->db ->value (3.14 );
357
357
$ this ->assertEquals ("3.140000 " , $ result );
358
358
359
- setlocale (LC_ALL , $ restore );
359
+ setlocale (LC_NUMERIC , $ restore );
360
360
}
361
361
362
362
/**
@@ -784,7 +784,7 @@ public function testOrderAdditionalParams() {
784
784
}
785
785
786
786
/**
787
- * Test it is possible to do a SELECT COUNT(DISTINCT Model.field)
787
+ * Test it is possible to do a SELECT COUNT(DISTINCT Model.field)
788
788
* query in postgres and it gets correctly quoted
789
789
*
790
790
* @return void
Original file line number Diff line number Diff line change @@ -6313,16 +6313,16 @@ public function testUpdateAllWithoutForeignKey() {
6313
6313
* @return void
6314
6314
*/
6315
6315
public function testWriteFloatAsGerman () {
6316
- $ restore = setlocale (LC_ALL , 0 );
6317
- setlocale (LC_ALL , 'de_DE ' );
6316
+ $ restore = setlocale (LC_NUMERIC , 0 );
6317
+ setlocale (LC_NUMERIC , 'de_DE ' );
6318
6318
6319
6319
$ model = new DataTest ();
6320
6320
$ result = $ model ->save (array (
6321
6321
'count ' => 1 ,
6322
6322
'float ' => 3.14593
6323
6323
));
6324
6324
$ this ->assertTrue ((bool )$ result );
6325
- setlocale (LC_ALL , $ restore );
6325
+ setlocale (LC_NUMERIC , $ restore );
6326
6326
}
6327
6327
6328
6328
/**
Original file line number Diff line number Diff line change @@ -490,14 +490,14 @@ public function testToReadableSize() {
490
490
* @return void
491
491
*/
492
492
public function testReadableSizeLocalized () {
493
- $ restore = setlocale (LC_ALL , 0 );
494
- setlocale (LC_ALL , 'de_DE ' );
493
+ $ restore = setlocale (LC_NUMERIC , 0 );
494
+ setlocale (LC_NUMERIC , 'de_DE ' );
495
495
$ result = $ this ->Number ->toReadableSize (1321205 );
496
496
$ this ->assertRegExp ('/1[,.]26 MB/ ' , $ result );
497
497
498
498
$ result = $ this ->Number ->toReadableSize (1024 * 1024 * 1024 * 512 );
499
499
$ this ->assertRegExp ('/512[,.]00 GB/ ' , $ result );
500
- setlocale (LC_ALL , $ restore );
500
+ setlocale (LC_NUMERIC , $ restore );
501
501
}
502
502
503
503
/**
Original file line number Diff line number Diff line change @@ -103,8 +103,11 @@ class ValidationTest extends CakeTestCase {
103
103
public function setUp () {
104
104
parent ::setUp ();
105
105
$ this ->_appEncoding = Configure::read ('App.encoding ' );
106
- $ this ->_appLocale = setlocale (LC_ALL , "0 " );
107
- setlocale (LC_ALL , 'en_US ' );
106
+ $ this ->_appLocale = array ();
107
+ foreach (array (LC_MONETARY , LC_NUMERIC , LC_TIME ) as $ category ) {
108
+ $ this ->_appLocale [$ category ] = setlocale ($ category , 0 );
109
+ setlocale ($ category , 'en_US ' );
110
+ }
108
111
}
109
112
110
113
/**
@@ -115,7 +118,9 @@ public function setUp() {
115
118
public function tearDown () {
116
119
parent ::tearDown ();
117
120
Configure::write ('App.encoding ' , $ this ->_appEncoding );
118
- setlocale (LC_ALL , $ this ->_appLocale );
121
+ foreach ($ this ->_appLocale as $ category => $ locale ) {
122
+ setlocale ($ category , $ locale );
123
+ }
119
124
}
120
125
121
126
/**
You can’t perform that action at this time.
0 commit comments