Fixed boolean test case
This commit is contained in:
parent
437fac4c9e
commit
2c16937dec
@ -5,39 +5,43 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
|
||||
$this->tables = array("BooleanTest");
|
||||
parent::prepareTables();
|
||||
}
|
||||
public function testSetFalse() {
|
||||
$test = new BooleanTest();
|
||||
$test->is_working = false;
|
||||
|
||||
public function testSet() {
|
||||
$this->assertEqual($test->is_working, false);
|
||||
$this->assertEqual($test->getState(), Doctrine_Record::STATE_TDIRTY);
|
||||
$test->save();
|
||||
|
||||
$test->refresh();
|
||||
$this->assertEqual($test->is_working, false);
|
||||
}
|
||||
|
||||
public function testSetTrue() {
|
||||
$test = new BooleanTest();
|
||||
$test->is_working = true;
|
||||
$this->assertEqual($test->is_working, true);
|
||||
$test->save();
|
||||
|
||||
$test->refresh();
|
||||
$this->assertEqual($test->is_working, true);
|
||||
|
||||
$this->connection->clear();
|
||||
|
||||
$test = $test->getTable()->find($test->id);
|
||||
$this->assertEqual($test->is_working, true);
|
||||
}
|
||||
|
||||
$test = new BooleanTest();
|
||||
$test->is_working = true;
|
||||
$test->save();
|
||||
|
||||
$test = new BooleanTest();
|
||||
$this->is_working = false;
|
||||
$this->assertEqual($test->is_working, false);
|
||||
$test->save();
|
||||
|
||||
$test = new BooleanTest();
|
||||
$this->is_working = false;
|
||||
$test->save();
|
||||
|
||||
$test = new BooleanTest();
|
||||
$this->is_working = false;
|
||||
$test->save();
|
||||
public function testFetching() {
|
||||
|
||||
$query = new Doctrine_Query($this->connection);
|
||||
$ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(false));
|
||||
$this->assertEqual(count($ret), 3);
|
||||
$this->assertEqual(count($ret), 1);
|
||||
|
||||
$query = new Doctrine_Query($this->connection);
|
||||
$ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(true));
|
||||
$this->assertEqual(count($ret), 2);
|
||||
|
||||
|
||||
$this->assertEqual(count($ret), 1);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user