From 2c16937dec46b7a875dc4347dd7cfacfb8744d5b Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 26 Sep 2006 20:45:29 +0000 Subject: [PATCH] Fixed boolean test case --- tests/BooleanTestCase.php | 46 +++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/tests/BooleanTestCase.php b/tests/BooleanTestCase.php index 47a21c96b..e20a76378 100644 --- a/tests/BooleanTestCase.php +++ b/tests/BooleanTestCase.php @@ -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); } + } ?>