Skip to content

Commit

Permalink
"CActiveRecordTest::testCountWithHavingRelational()" has been updated…
Browse files Browse the repository at this point in the history
… exposing issue #2201
  • Loading branch information
klimov-paul committed Mar 21, 2013
1 parent b8eaab4 commit 783a2ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/framework/db/ar/CActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1416,14 +1416,16 @@ public function testCountWithHaving()

/**
* @see https://github.com/yiisoft/yii/issues/135
* @see https://github.com/yiisoft/yii/issues/2201
*/
public function testCountWithHavingRelational()
{
$criteriaWithHaving = new CDbCriteria();
$criteriaWithHaving->select = 't.id AS test_field';
$criteriaWithHaving->with = array('author');
$criteriaWithHaving->group = 't.id';
$criteriaWithHaving->having = 'test_field = 1';
$criteriaWithHaving->having = 'test_field = :test_field';
$criteriaWithHaving->params['test_field'] = 1;
$count = Post::model()->count($criteriaWithHaving);

$this->assertEquals(1, $count, 'Having condition has not been applied on count with relation!');
Expand Down

0 comments on commit 783a2ea

Please sign in to comment.