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+
This commit is contained in:
parent
ae6894c3ed
commit
5a0645974f
@ -13,12 +13,12 @@ namespace Symfony\Component\Messenger\Tests\Transport\Doctrine;
|
|||||||
|
|
||||||
use Doctrine\DBAL\DBALException;
|
use Doctrine\DBAL\DBALException;
|
||||||
use Doctrine\DBAL\Driver\ResultStatement;
|
use Doctrine\DBAL\Driver\ResultStatement;
|
||||||
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
|
|
||||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Query\QueryBuilder;
|
use Doctrine\DBAL\Query\QueryBuilder;
|
||||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||||
use Doctrine\DBAL\Schema\SchemaConfig;
|
use Doctrine\DBAL\Schema\SchemaConfig;
|
||||||
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
|
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
|
||||||
|
use Doctrine\DBAL\Statement;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
|
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
|
||||||
@ -145,14 +145,10 @@ class ConnectionTest extends TestCase
|
|||||||
|
|
||||||
private function getStatementMock($expectedResult): ResultStatement
|
private function getStatementMock($expectedResult): ResultStatement
|
||||||
{
|
{
|
||||||
$mockedInterface = interface_exists(ForwardCompatibleResultStatement::class)
|
$stmt = $this->createMock(Statement::class);
|
||||||
? ForwardCompatibleResultStatement::class
|
|
||||||
: ResultStatement::class;
|
|
||||||
|
|
||||||
$stmt = $this->createMock($mockedInterface);
|
|
||||||
|
|
||||||
$stmt->expects($this->once())
|
$stmt->expects($this->once())
|
||||||
->method(method_exists($mockedInterface, 'fetchAssociative') ? 'fetchAssociative' : 'fetch')
|
->method(method_exists(Statement::class, 'fetchAssociative') ? 'fetchAssociative' : 'fetch')
|
||||||
->willReturn($expectedResult);
|
->willReturn($expectedResult);
|
||||||
|
|
||||||
return $stmt;
|
return $stmt;
|
||||||
@ -312,12 +308,9 @@ class ConnectionTest extends TestCase
|
|||||||
'headers' => json_encode(['type' => DummyMessage::class]),
|
'headers' => json_encode(['type' => DummyMessage::class]),
|
||||||
];
|
];
|
||||||
|
|
||||||
$mockedInterface = interface_exists(ForwardCompatibleResultStatement::class)
|
$stmt = $this->createMock(Statement::class);
|
||||||
? ForwardCompatibleResultStatement::class
|
|
||||||
: ResultStatement::class;
|
|
||||||
$stmt = $this->createMock($mockedInterface);
|
|
||||||
$stmt->expects($this->once())
|
$stmt->expects($this->once())
|
||||||
->method(method_exists($mockedInterface, 'fetchAllAssociative') ? 'fetchAllAssociative' : 'fetchAll')
|
->method(method_exists(Statement::class, 'fetchAllAssociative') ? 'fetchAllAssociative' : 'fetchAll')
|
||||||
->willReturn([$message1, $message2]);
|
->willReturn([$message1, $message2]);
|
||||||
|
|
||||||
$driverConnection
|
$driverConnection
|
||||||
|
Reference in New Issue
Block a user