Skip to content
Permalink
Browse files

Updating test for booleans in postgres

  • Loading branch information...
lorenzo committed Oct 27, 2010
1 parent d9222cf commit b3d8a619a3d5de7bd3177750033091f35f828719
@@ -732,12 +732,16 @@ function boolean($data, $quote = true) {
switch (true) {
case ($data === true || $data === false):
$result = $data;
break;
case ($data === 't' || $data === 'f'):
$result = ($data === 't');
break;
case ($data === 'true' || $data === 'false'):
$result = ($data === 'true');
break;
case ($data === 'TRUE' || $data === 'FALSE'):
$result = ($data === 'TRUE');
break;
default:
$result = (bool) $data;
break;
@@ -340,18 +340,18 @@ function testValueQuoting() {
$this->assertEqual($this->Dbo->value('', 'float', false), "NULL");
$this->assertEqual($this->Dbo->value('0.0', 'float'), "'0.0'");
$this->assertEqual($this->Dbo->value('t', 'boolean'), true);
$this->assertEqual($this->Dbo->value('f', 'boolean'), false);
$this->assertEqual($this->Dbo->value(true), true);
$this->assertEqual($this->Dbo->value(false), false);
$this->assertEqual($this->Dbo->value('t', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('f', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(true), "'TRUE'");
$this->assertEqual($this->Dbo->value(false), "'FALSE'");
$this->assertEqual($this->Dbo->value('t'), "'t'");
$this->assertEqual($this->Dbo->value('f'), "'f'");
$this->assertEqual($this->Dbo->value('true', 'boolean'), true);
$this->assertEqual($this->Dbo->value('false', 'boolean'), false);
$this->assertEqual($this->Dbo->value('', 'boolean'), false);
$this->assertEqual($this->Dbo->value(0, 'boolean'), false);
$this->assertEqual($this->Dbo->value(1, 'boolean'), true);
$this->assertEqual($this->Dbo->value('1', 'boolean'), true);
$this->assertEqual($this->Dbo->value('true', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('false', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value('', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(0, 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(1, 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('1', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value(null, 'boolean'), "NULL");
$this->assertEqual($this->Dbo->value(array()), "NULL");
}

0 comments on commit b3d8a61

Please sign in to comment.
You can’t perform that action at this time.