From 02ba144c8dfa320e58f20cc9c8ebc5247fce29ef Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 27 Aug 2014 01:55:28 +0200 Subject: [PATCH] Adding test to verify SQL generation with an expression in `COUNT()` --- .../Tests/ORM/Query/SelectSqlGenerationTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index e886307f6..0a35b3bdb 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -263,6 +263,21 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase ); } + public function testSupportsAggregateCountFunctionWithSimpleArithmetic() + { + $connMock = $this->_em->getConnection(); + $orgPlatform = $connMock->getDatabasePlatform(); + + $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform); + + $this->assertSqlGeneration( + 'SELECT COUNT(CONCAT(u.id, u.name)) FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY u.id', + 'SELECT COUNT(CONCAT(c0_.id, c0_.name)) AS sclr_0 FROM cms_users c0_ GROUP BY c0_.id' + ); + + $connMock->setDatabasePlatform($orgPlatform); + } + public function testSupportsWhereClauseWithPositionalParameter() { $this->assertSqlGeneration(