File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
cake/tests/cases/libs/model Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,24 @@ function testQuoting() {
277
277
$ this ->assertEqual ($ expected , $ result );
278
278
}
279
279
280
+ /**
281
+ * test that localized floats don't cause trouble.
282
+ *
283
+ * @return void
284
+ */
285
+ function testLocalizedFloats () {
286
+ $ restore = setlocale (LC_ALL , null );
287
+ setlocale (LC_ALL , 'de_DE ' );
288
+
289
+ $ result = $ this ->db ->value (3.141593 , 'float ' );
290
+ $ this ->assertEqual ((string )$ result , '3.141593 ' );
291
+
292
+ $ result = $ this ->db ->value (3.141593 );
293
+ $ this ->assertEqual ((string )$ result , '3.141593 ' );
294
+
295
+ setlocale (LC_ALL , $ restore );
296
+ }
297
+
280
298
/**
281
299
* testTinyintCasting method
282
300
*
Original file line number Diff line number Diff line change @@ -3880,4 +3880,22 @@ function testSaveAllEmptyData() {
3880
3880
$ this ->assertFalse ($ result );
3881
3881
}
3882
3882
3883
+ /**
3884
+ * test writing floats in german locale.
3885
+ *
3886
+ * @return void
3887
+ */
3888
+ function testWriteFloatAsGerman () {
3889
+ $ restore = setlocale (LC_ALL , null );
3890
+ setlocale (LC_ALL , 'de_DE ' );
3891
+
3892
+ $ model = new DataTest ();
3893
+ $ result = $ model ->save (array (
3894
+ 'count ' => 1 ,
3895
+ 'float ' => 3.14593
3896
+ ));
3897
+ $ this ->assertTrue ($ result );
3898
+ setlocale (LC_ALL , $ restore );
3899
+ }
3900
+
3883
3901
}
You can’t perform that action at this time.
0 commit comments