mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding tests to dbo_postgres for localized floats. Refs #1029
This commit is contained in:
parent
afc05c1e05
commit
eb96d8acfb
1 changed files with 19 additions and 1 deletions
|
@ -352,7 +352,7 @@ class DboPostgresTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testValueQuoting() {
|
function testValueQuoting() {
|
||||||
$this->assertIdentical($this->db2->value(1.2, 'float'), "'1.2'");
|
$this->assertIdentical($this->db2->value(1.2, 'float'), "'1.200000'");
|
||||||
$this->assertEqual($this->db2->value('1,2', 'float'), "'1,2'");
|
$this->assertEqual($this->db2->value('1,2', 'float'), "'1,2'");
|
||||||
|
|
||||||
$this->assertEqual($this->db2->value('0', 'integer'), "'0'");
|
$this->assertEqual($this->db2->value('0', 'integer'), "'0'");
|
||||||
|
@ -378,6 +378,24 @@ class DboPostgresTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->db2->value(array()), "NULL");
|
$this->assertEqual($this->db2->value(array()), "NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that localized floats don't cause trouble.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testLocalizedFloats() {
|
||||||
|
$restore = setlocale(LC_ALL, null);
|
||||||
|
setlocale(LC_ALL, 'de_DE');
|
||||||
|
|
||||||
|
$result = $this->db->value(3.141593, 'float');
|
||||||
|
$this->assertEqual((string)$result, "'3.141593'");
|
||||||
|
|
||||||
|
$result = $this->db->value(3.14);
|
||||||
|
$this->assertEqual((string)$result, "'3.140000'");
|
||||||
|
|
||||||
|
setlocale(LC_ALL, $restore);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that date and time columns do not generate errors with null and nullish values.
|
* test that date and time columns do not generate errors with null and nullish values.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue