Skip to content

Commit 5b1f455

Browse files
fabpotnicolas-grekas
authored andcommitted
minor #37141 [Messenger] fix forward compatibility with Doctrine DBAL 2.11+ (xabbuh)
This PR was merged into the 5.1 branch. Discussion ---------- [Messenger] fix forward compatibility with Doctrine DBAL 2.11+ | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | The methods will be deprecated in 2.11 (see doctrine/dbal#4019), but the forward compatibility layer is only present in 3.0 (see doctrine/dbal#4007). Commits ------- bca4f9970b fix forward compatibility with Doctrine DBAL 2.11+
1 parent a97df38 commit 5b1f455

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

Tests/Transport/Doctrine/ConnectionTest.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
use Doctrine\DBAL\DBALException;
1515
use Doctrine\DBAL\Driver\ResultStatement;
16-
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
1716
use Doctrine\DBAL\Platforms\AbstractPlatform;
1817
use Doctrine\DBAL\Query\QueryBuilder;
1918
use Doctrine\DBAL\Schema\AbstractSchemaManager;
2019
use Doctrine\DBAL\Schema\SchemaConfig;
2120
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
21+
use Doctrine\DBAL\Statement;
2222
use PHPUnit\Framework\TestCase;
2323
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
2424
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
@@ -145,14 +145,10 @@ private function getQueryBuilderMock()
145145

146146
private function getStatementMock($expectedResult): ResultStatement
147147
{
148-
$mockedInterface = interface_exists(ForwardCompatibleResultStatement::class)
149-
? ForwardCompatibleResultStatement::class
150-
: ResultStatement::class;
151-
152-
$stmt = $this->createMock($mockedInterface);
148+
$stmt = $this->createMock(Statement::class);
153149

154150
$stmt->expects($this->once())
155-
->method(method_exists($mockedInterface, 'fetchAssociative') ? 'fetchAssociative' : 'fetch')
151+
->method(method_exists(Statement::class, 'fetchAssociative') ? 'fetchAssociative' : 'fetch')
156152
->willReturn($expectedResult);
157153

158154
return $stmt;
@@ -312,12 +308,9 @@ public function testFindAll()
312308
'headers' => json_encode(['type' => DummyMessage::class]),
313309
];
314310

315-
$mockedInterface = interface_exists(ForwardCompatibleResultStatement::class)
316-
? ForwardCompatibleResultStatement::class
317-
: ResultStatement::class;
318-
$stmt = $this->createMock($mockedInterface);
311+
$stmt = $this->createMock(Statement::class);
319312
$stmt->expects($this->once())
320-
->method(method_exists($mockedInterface, 'fetchAllAssociative') ? 'fetchAllAssociative' : 'fetchAll')
313+
->method(method_exists(Statement::class, 'fetchAllAssociative') ? 'fetchAllAssociative' : 'fetchAll')
321314
->willReturn([$message1, $message2]);
322315

323316
$driverConnection

0 commit comments

Comments
 (0)