Skip to content

Commit

Permalink
Merge pull request #3345 from acrobat/fix-doctrine-unit-tests
Browse files Browse the repository at this point in the history
[AdminListBundle] Fix doctrine related unit tests
  • Loading branch information
acrobat authored Mar 5, 2024
2 parents 2126de4 + 6d75dd6 commit 30ecf47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 30ecf47

Please sign in to comment.