1
0
mirror of synced 2025-01-18 06:21:40 +03:00

pookey: added boolean test cases for setting null values

This commit is contained in:
pookey 2006-10-02 01:31:07 +00:00
parent aa25b57eda
commit 9589f486ef
2 changed files with 24 additions and 0 deletions

View File

@ -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;

View File

@ -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 {