boolean test case added (currently fails on selecting when false)
This commit is contained in:
parent
1862f00fc6
commit
8ea7b0b8b5
43
tests/BooleanTestCase.php
Normal file
43
tests/BooleanTestCase.php
Normal 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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -438,4 +438,10 @@ class Phototag extends Doctrine_Record {
|
|||||||
$this->hasColumn("tag_id", "integer");
|
$this->hasColumn("tag_id", "integer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BooleanTest extends Doctrine_Record {
|
||||||
|
public function setTableDefinition() {
|
||||||
|
$this->hasColumn('is_working', 'boolean');
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -28,6 +28,7 @@ require_once("QueryReferenceModelTestCase.php");
|
|||||||
require_once("DBTestCase.php");
|
require_once("DBTestCase.php");
|
||||||
require_once("SchemaTestCase.php");
|
require_once("SchemaTestCase.php");
|
||||||
require_once("ImportTestCase.php");
|
require_once("ImportTestCase.php");
|
||||||
|
require_once("BooleanTestCase.php");
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ $test->addTestCase(new Doctrine_QueryTestCase());
|
|||||||
|
|
||||||
$test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());
|
$test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());
|
||||||
|
|
||||||
|
$test->addTestCase(new Doctrine_BooleanTestCase());
|
||||||
|
|
||||||
|
|
||||||
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
|
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
|
||||||
|
Loading…
Reference in New Issue
Block a user