diff --git a/tests/BooleanTestCase.php b/tests/BooleanTestCase.php index 953fc28b2..f9a49df1b 100644 --- a/tests/BooleanTestCase.php +++ b/tests/BooleanTestCase.php @@ -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; diff --git a/tests/classes.php b/tests/classes.php index 39c6d08fd..99344f7b1 100644 --- a/tests/classes.php +++ b/tests/classes.php @@ -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 {