Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02ba144

Browse files
committed
Adding test to verify SQL generation with an expression in COUNT()
1 parent 91fa4c9 commit 02ba144

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,21 @@ public function testSupportsAggregateFunctionWithSimpleArithmetic()
263263
);
264264
}
265265

266+
public function testSupportsAggregateCountFunctionWithSimpleArithmetic()
267+
{
268+
$connMock = $this->_em->getConnection();
269+
$orgPlatform = $connMock->getDatabasePlatform();
270+
271+
$connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform);
272+
273+
$this->assertSqlGeneration(
274+
'SELECT COUNT(CONCAT(u.id, u.name)) FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY u.id',
275+
'SELECT COUNT(CONCAT(c0_.id, c0_.name)) AS sclr_0 FROM cms_users c0_ GROUP BY c0_.id'
276+
);
277+
278+
$connMock->setDatabasePlatform($orgPlatform);
279+
}
280+
266281
public function testSupportsWhereClauseWithPositionalParameter()
267282
{
268283
$this->assertSqlGeneration(

0 commit comments

Comments
 (0)