Commit 8ea7b0b8 authored by pookey's avatar pookey

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

parent 1862f00f
<?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");
}
}
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("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());
......
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