Commit 9589f486 authored by pookey's avatar pookey

pookey: added boolean test cases for setting null values

parent aa25b57e
......@@ -5,6 +5,29 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
$this->tables = array("BooleanTest");
parent::prepareTables();
}
public function testSetNull() {
$test = new BooleanTest();
$this->is_working = null;
$this->assertEqual($this->is_working, null);
$this->assertEqual($test->getState(), Doctrine_Record::STATE_TDIRTY);
$test->save();
$test->refresh();
$this->assertEqual($test->is_working, null);
$test = new BooleanTest();
$this->is_working_notnull = null;
$this->assertEqual($this->is_working_notnull, false);
$this->assertEqual($test->getState(), Doctrine_Record::STATE_TDIRTY);
$test->save();
$test->refresh();
$this->assertEqual($test->is_working_notnull, false);
}
public function testSetFalse() {
$test = new BooleanTest();
$test->is_working = false;
......
......@@ -458,6 +458,7 @@ class Phototag extends Doctrine_Record {
class BooleanTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('is_working', 'boolean');
$this->hasColumn('is_working_notnull', 'boolean', 1, array('default' => false, 'notnull' => true));
}
}
class Data_File extends Doctrine_Record {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment