1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Fixed boolean test case

This commit is contained in:
zYne 2006-09-26 20:45:29 +00:00
parent 437fac4c9e
commit 2c16937dec

View File

@ -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);
}
}
?>