Skip to content
Browse files

add test for multiple HAVING conditions

  • Loading branch information...
1 parent 0eacc54 commit 292fc7a2aebe142eeed53dfc42e9dea820f3107e @havvg havvg committed Feb 21, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/testsuite/runtime/query/CriteriaTest.php
View
14 test/testsuite/runtime/query/CriteriaTest.php
@@ -924,6 +924,20 @@ public function testHaving()
$expected = 'SELECT book.TITLE, book.ISBN AS isb_n FROM book HAVING isb_n=\'1234567890123\'';
$this->assertEquals($expected, $this->con->getLastExecutedQuery());
}
+
+ public function testMultipleHaving()
+ {
+ $c = new Criteria();
+ $c->addSelectColumn(BookPeer::TITLE);
+ $c->addAsColumn('isb_n', BookPeer::ISBN);
+ $crit = $c->getNewCriterion('isb_n', '1234567890123');
+ $crit->addAnd($c->getNewCriterion(BookPeer::TITLE, 'Foobar'));
+ $c->addHaving($crit);
+ $expected = 'SELECT book.TITLE, book.ISBN AS isb_n FROM book HAVING (isb_n=:p1 AND book.TITLE=:p2)';
+ $params = array();
+ $result = BasePeer::createSelectSql($c, $params);
+ $this->assertEquals($expected, $result);
+ }
public function testHavingRaw()
{

0 comments on commit 292fc7a

Please sign in to comment.
Something went wrong with that request. Please try again.