From 6d75dd69a2912bd8576a5dd2569f17b095b1d1ca Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Tue, 5 Mar 2024 19:21:50 +0100 Subject: [PATCH] [AdminListBundle] Fix doctrine related unit tests --- .../AbstractDoctrineDBALAdminListConfiguratorTest.php | 2 ++ .../Tests/AdminList/FilterType/DBAL/BaseDbalFilterTest.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/Kunstmaan/AdminListBundle/Tests/AdminList/Configurator/AbstractDoctrineDBALAdminListConfiguratorTest.php b/src/Kunstmaan/AdminListBundle/Tests/AdminList/Configurator/AbstractDoctrineDBALAdminListConfiguratorTest.php index 33fc135e18..102e4fde40 100644 --- a/src/Kunstmaan/AdminListBundle/Tests/AdminList/Configurator/AbstractDoctrineDBALAdminListConfiguratorTest.php +++ b/src/Kunstmaan/AdminListBundle/Tests/AdminList/Configurator/AbstractDoctrineDBALAdminListConfiguratorTest.php @@ -4,6 +4,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\ForwardCompatibility\DriverStatement; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Query\QueryBuilder; use Doctrine\DBAL\Result; use Doctrine\DBAL\Statement; @@ -24,6 +25,7 @@ class AbstractDoctrineDBALAdminListConfiguratorTest extends TestCase public function setUp(): void { $this->connectionMock = $this->createMock(Connection::class); + $this->connectionMock->method('getDatabasePlatform')->willReturn(new MySQLPlatform()); $this->connectionMock ->expects($this->any()) ->method('executeQuery') diff --git a/src/Kunstmaan/AdminListBundle/Tests/AdminList/FilterType/DBAL/BaseDbalFilterTest.php b/src/Kunstmaan/AdminListBundle/Tests/AdminList/FilterType/DBAL/BaseDbalFilterTest.php index e7cb9fcf24..4b6bc10f2a 100644 --- a/src/Kunstmaan/AdminListBundle/Tests/AdminList/FilterType/DBAL/BaseDbalFilterTest.php +++ b/src/Kunstmaan/AdminListBundle/Tests/AdminList/FilterType/DBAL/BaseDbalFilterTest.php @@ -3,6 +3,7 @@ namespace Kunstmaan\AdminListBundle\Tests\AdminList\FilterType\DBAL; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; use Doctrine\DBAL\Query\QueryBuilder; use PHPUnit\Framework\TestCase; @@ -14,6 +15,10 @@ public function getQueryBuilder() $conn = $this->createMock(Connection::class); $expressionBuilder = new ExpressionBuilder($conn); + $conn->method('getDatabasePlatform')->willReturn(new MySQLPlatform()); + if (method_exists(Connection::class, 'createExpressionBuilder')) { + $conn->method('createExpressionBuilder')->willReturn($expressionBuilder); + } $conn->method('getExpressionBuilder')->willReturn($expressionBuilder); return new QueryBuilder($conn);