Permalink
Browse files

Merge pull request #299 from havvg/master

add a testcase for multiple HAVING conditions
  • Loading branch information...
2 parents 0eacc54 + 292fc7a commit 82894e7d5ca342271ee5889f10a77dc33cf84e80 @willdurand willdurand committed Feb 21, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 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 82894e7

Please sign in to comment.