[Messenger] Fix deprecation
This commit is contained in:
parent
12f46ba538
commit
a656a57736
@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Messenger\Tests\Transport\Doctrine;
|
namespace Symfony\Component\Messenger\Tests\Transport\Doctrine;
|
||||||
|
|
||||||
use Doctrine\Common\Persistence\ConnectionRegistry;
|
use Doctrine\Common\Persistence\ConnectionRegistry as LegacyConnectionRegistry;
|
||||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||||
use Doctrine\DBAL\Schema\SchemaConfig;
|
use Doctrine\DBAL\Schema\SchemaConfig;
|
||||||
|
use Doctrine\Persistence\ConnectionRegistry;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
|
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
|
||||||
use Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransport;
|
use Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransport;
|
||||||
@ -25,7 +26,7 @@ class DoctrineTransportFactoryTest extends TestCase
|
|||||||
public function testSupports()
|
public function testSupports()
|
||||||
{
|
{
|
||||||
$factory = new DoctrineTransportFactory(
|
$factory = new DoctrineTransportFactory(
|
||||||
$this->createMock(ConnectionRegistry::class)
|
$this->createMock(interface_exists(ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($factory->supports('doctrine://default', []));
|
$this->assertTrue($factory->supports('doctrine://default', []));
|
||||||
@ -39,7 +40,7 @@ class DoctrineTransportFactoryTest extends TestCase
|
|||||||
$schemaConfig = $this->createMock(SchemaConfig::class);
|
$schemaConfig = $this->createMock(SchemaConfig::class);
|
||||||
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
|
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
|
||||||
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
|
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
|
||||||
$registry = $this->createMock(ConnectionRegistry::class);
|
$registry = $this->createMock(interface_exists(ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry::class);
|
||||||
|
|
||||||
$registry->expects($this->once())
|
$registry->expects($this->once())
|
||||||
->method('getConnection')
|
->method('getConnection')
|
||||||
@ -58,7 +59,7 @@ class DoctrineTransportFactoryTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\Messenger\Exception\TransportException');
|
$this->expectException('Symfony\Component\Messenger\Exception\TransportException');
|
||||||
$this->expectExceptionMessage('Could not find Doctrine connection from Messenger DSN "doctrine://default".');
|
$this->expectExceptionMessage('Could not find Doctrine connection from Messenger DSN "doctrine://default".');
|
||||||
$registry = $this->createMock(ConnectionRegistry::class);
|
$registry = $this->createMock(interface_exists(ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry::class);
|
||||||
$registry->expects($this->once())
|
$registry->expects($this->once())
|
||||||
->method('getConnection')
|
->method('getConnection')
|
||||||
->willReturnCallback(function () {
|
->willReturnCallback(function () {
|
||||||
|
Reference in New Issue
Block a user