Skip to content

Commit

Permalink
Merge branch '5.0'
Browse files Browse the repository at this point in the history
* 5.0:
  [Messenger] Fix deprecation
  • Loading branch information
nicolas-grekas committed Dec 12, 2019
2 parents a8b6ba3 + 5b06e01 commit 20811ce
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

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\SchemaConfig;
use Doctrine\Persistence\ConnectionRegistry;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
use Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransport;
Expand All @@ -25,7 +26,7 @@ class DoctrineTransportFactoryTest extends TestCase
public function testSupports()
{
$factory = new DoctrineTransportFactory(
$this->createMock(ConnectionRegistry::class)
$this->createMock(interface_exists(ConnectionRegistry::class) ? ConnectionRegistry::class : LegacyConnectionRegistry::class)
);

$this->assertTrue($factory->supports('doctrine://default', []));
Expand All @@ -39,7 +40,7 @@ public function testCreateTransport()
$schemaConfig = $this->createMock(SchemaConfig::class);
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
$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())
->method('getConnection')
Expand All @@ -58,7 +59,7 @@ public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
{
$this->expectException('Symfony\Component\Messenger\Exception\TransportException');
$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())
->method('getConnection')
->willReturnCallback(function () {
Expand Down

0 comments on commit 20811ce

Please sign in to comment.