Commit 2c16937d authored by zYne's avatar zYne

Fixed boolean test case

parent 437fac4c
......@@ -5,39 +5,43 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
$this->tables = array("BooleanTest");
parent::prepareTables();
}
public function testSet() {
public function testSetFalse() {
$test = new BooleanTest();
$test->is_working = true;
$this->assertEqual($test->is_working, true);
$test->save();
$test->is_working = false;
$test = new BooleanTest();
$test->is_working = true;
$this->assertEqual($test->is_working, false);
$this->assertEqual($test->getState(), Doctrine_Record::STATE_TDIRTY);
$test->save();
$test = new BooleanTest();
$this->is_working = false;
$test->refresh();
$this->assertEqual($test->is_working, false);
$test->save();
}
public function testSetTrue() {
$test = new BooleanTest();
$this->is_working = false;
$test->is_working = true;
$this->assertEqual($test->is_working, true);
$test->save();
$test = new BooleanTest();
$this->is_working = false;
$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);
}
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);
}
}
?>
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