Skip to content

Commit

Permalink
Adding tests to dbo_postgres for localized floats. Refs #1029
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 21, 2010
1 parent afc05c1 commit eb96d8a
Showing 1 changed file with 19 additions and 1 deletion.
Expand Up @@ -352,7 +352,7 @@ function testColumnParsing() {
* @return void
*/
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('0', 'integer'), "'0'");
Expand All @@ -378,6 +378,24 @@ function testValueQuoting() {
$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.
*
Expand Down

0 comments on commit eb96d8a

Please sign in to comment.