From 8ea7b0b8b5b008d0e80b375abd70415440f1c9e7 Mon Sep 17 00:00:00 2001 From: pookey Date: Thu, 21 Sep 2006 21:18:30 +0000 Subject: [PATCH] boolean test case added (currently fails on selecting when false) --- tests/BooleanTestCase.php | 43 +++++++++++++++++++++++++++++++++++++++ tests/classes.php | 6 ++++++ tests/run.php | 2 ++ 3 files changed, 51 insertions(+) create mode 100644 tests/BooleanTestCase.php diff --git a/tests/BooleanTestCase.php b/tests/BooleanTestCase.php new file mode 100644 index 000000000..47a21c96b --- /dev/null +++ b/tests/BooleanTestCase.php @@ -0,0 +1,43 @@ +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); + + + } +} +?> diff --git a/tests/classes.php b/tests/classes.php index a50c1ae83..df5e9b527 100644 --- a/tests/classes.php +++ b/tests/classes.php @@ -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'); + } +} ?> diff --git a/tests/run.php b/tests/run.php index baaf388df..4ae621985 100644 --- a/tests/run.php +++ b/tests/run.php @@ -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());