diff --git a/unit-tests/ModelsQueryExecuteTest.php b/unit-tests/ModelsQueryExecuteTest.php index 9e7138873b7..c68a55a8be1 100644 --- a/unit-tests/ModelsQueryExecuteTest.php +++ b/unit-tests/ModelsQueryExecuteTest.php @@ -423,6 +423,18 @@ public function _testSelectExecute($di) $this->assertEquals(2, $result[0]->{"0"}); $this->assertInstanceOf('Phalcon\Mvc\Model\Row', $result[0]); + $result = $manager->executeQuery('SELECT CASE 1 WHEN 1 THEN 2 END FROM Robots'); + $this->assertInstanceOf('Phalcon\Mvc\Model\Resultset\Complex', $result); + $this->assertEquals(2, $result[0]->{"0"}); + + $result = $manager->executeQuery('SELECT CASE 2 WHEN 1 THEN 2 WHEN 2 THEN 3 END FROM Robots'); + $this->assertInstanceOf('Phalcon\Mvc\Model\Resultset\Complex', $result); + $this->assertEquals(3, $result[0]->{"0"}); + + $result = $manager->executeQuery('SELECT CASE 2 WHEN 1 THEN 2 ELSE 3 END FROM Robots'); + $this->assertInstanceOf('Phalcon\Mvc\Model\Resultset\Complex', $result); + $this->assertEquals(3, $result[0]->{"0"}); + // Issue 1011 /*$result = $manager->executeQuery('SELECT r.name le_name FROM Robots r ORDER BY r.name ASC LIMIT ?1,?2', array(1 => 1, 2 => 2),