1
0
mirror of synced 2024-12-13 14:56:01 +03:00

boolean test case added (currently fails on selecting when false)

This commit is contained in:
pookey 2006-09-21 21:18:30 +00:00
parent 1862f00fc6
commit 8ea7b0b8b5
3 changed files with 51 additions and 0 deletions

43
tests/BooleanTestCase.php Normal file
View File

@ -0,0 +1,43 @@
<?php
class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
public function prepareTables() {
$this->tables = array("BooleanTest");
parent::prepareTables();
}
public function testSet() {
$test = new BooleanTest();
$test->is_working = true;
$this->assertEqual($test->is_working, true);
$test->save();
$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();
$query = new Doctrine_Query($this->connection);
$ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(false));
$this->assertEqual(count($ret), 3);
$query = new Doctrine_Query($this->connection);
$ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(true));
$this->assertEqual(count($ret), 2);
}
}
?>

View File

@ -438,4 +438,10 @@ class Phototag extends Doctrine_Record {
$this->hasColumn("tag_id", "integer");
}
}
class BooleanTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('is_working', 'boolean');
}
}
?>

View File

@ -28,6 +28,7 @@ require_once("QueryReferenceModelTestCase.php");
require_once("DBTestCase.php");
require_once("SchemaTestCase.php");
require_once("ImportTestCase.php");
require_once("BooleanTestCase.php");
error_reporting(E_ALL);
@ -82,6 +83,7 @@ $test->addTestCase(new Doctrine_QueryTestCase());
$test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());
$test->addTestCase(new Doctrine_BooleanTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());