Skip to content

Commit

Permalink
Merge d7e7baf into 196ea2d
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Jan 8, 2016
2 parents 196ea2d + d7e7baf commit 7739442
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
Expand Up @@ -2271,6 +2271,27 @@ public function testHavingSupportResultVariableInAggregateFunction()
'SELECT COUNT(c0_.name) AS sclr_0 FROM cms_users c0_ HAVING sclr_0 IS NULL'
);
}

/**
* GitHub issue #4764: https://github.com/doctrine/doctrine2/issues/4764
* @group DDC-3907
* @dataProvider mathematicOperatorsProvider
*/
public function testHavingRegressionUsingVariableWithMathOperatorsExpression($operator)
{
$this->assertSqlGeneration(
'SELECT COUNT(u.name) AS countName FROM Doctrine\Tests\Models\CMS\CmsUser u HAVING 1 ' . $operator . ' countName > 0',
'SELECT COUNT(c0_.name) AS sclr_0 FROM cms_users c0_ HAVING 1 ' . $operator . ' sclr_0 > 0'
);
}

/**
* @return array
*/
public function mathematicOperatorsProvider()
{
return [['+'], ['-'], ['*'], ['/']];
}
}

class MyAbsFunction extends \Doctrine\ORM\Query\AST\Functions\FunctionNode
Expand Down

0 comments on commit 7739442

Please sign in to comment.