Commit 2c16937d authored by zYne's avatar zYne

Fixed boolean test case

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