From edaf23df2db75fff6cd5dd585acf35078f575dfa Mon Sep 17 00:00:00 2001 From: pookey Date: Sun, 15 Oct 2006 22:50:46 +0000 Subject: [PATCH] adding new enum tests ( refs #170 ) --- tests/EnumTestCase.php | 51 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/tests/EnumTestCase.php b/tests/EnumTestCase.php index 2b7b64612..580c57f4a 100644 --- a/tests/EnumTestCase.php +++ b/tests/EnumTestCase.php @@ -12,15 +12,52 @@ class Doctrine_EnumTestCase extends Doctrine_UnitTestCase { $this->assertEqual($test->status, 'open'); $test->save(); - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM EnumTest WHERE EnumTest.status = ?', array('open')); - $this->assertEqual(count($ret), 1); - - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM EnumTest WHERE EnumTest.status = open'); - $this->assertEqual(count($ret), 1); + try { + $query = new Doctrine_Query($this->connection); + $ret = $query->query('FROM EnumTest WHERE EnumTest.status = ?', array('open')); + $this->assertEqual(count($ret), 1); + } catch (Exception $e) { + $this->fail(); + } + try { + $query = new Doctrine_Query($this->connection); + $ret = $query->query('FROM EnumTest WHERE EnumTest.status = open'); + $this->assertEqual(count($ret), 1); + } catch (Exception $e) { + $this->fail(); + } } + + public function testInAndNotIn() { + try { + $query = new Doctrine_Query($this->connection); + $ret = $query->query('FROM EnumTest WHERE EnumTest.status IN (open)'); + $this->assertEqual(count($ret), 1); + } catch (Exception $e) { + $this->fail(); + } + + try { + $query = new Doctrine_Query($this->connection); + $ret = $query->query('FROM EnumTest WHERE EnumTest.status NOT IN (verified, closed)'); + $this->assertEqual(count($ret), 1); + } catch (Exception $e) { + $this->fail(); + } + } + + public function testNotEqual() + { + try { + $query = new Doctrine_Query($this->connection); + $ret = $query->query('FROM EnumTest WHERE EnumTest.status != closed'); + $this->assertEqual(count($ret), 1); + } catch (Exception $e) { + $this->fail(); + } + } + public function testEnumType() { $enum = new EnumTest();