pookey: added boolean test cases for setting null values
This commit is contained in:
parent
aa25b57eda
commit
9589f486ef
@ -5,6 +5,29 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
|
|||||||
$this->tables = array("BooleanTest");
|
$this->tables = array("BooleanTest");
|
||||||
parent::prepareTables();
|
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() {
|
public function testSetFalse() {
|
||||||
$test = new BooleanTest();
|
$test = new BooleanTest();
|
||||||
$test->is_working = false;
|
$test->is_working = false;
|
||||||
|
@ -458,6 +458,7 @@ class Phototag extends Doctrine_Record {
|
|||||||
class BooleanTest extends Doctrine_Record {
|
class BooleanTest extends Doctrine_Record {
|
||||||
public function setTableDefinition() {
|
public function setTableDefinition() {
|
||||||
$this->hasColumn('is_working', 'boolean');
|
$this->hasColumn('is_working', 'boolean');
|
||||||
|
$this->hasColumn('is_working_notnull', 'boolean', 1, array('default' => false, 'notnull' => true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Data_File extends Doctrine_Record {
|
class Data_File extends Doctrine_Record {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user