8000 Get Database platform from connection · symfony/symfony@b0c73c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0c73c7

Browse files
committed
Get Database platform from connection
1 parent daae218 commit b0c73c7

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineTransportFactoryTest.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport;
1313

14-
use Doctrine\DBAL\Driver;
1514
use Doctrine\DBAL\Platforms\AbstractPlatform;
1615
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1716
use Doctrine\DBAL\Schema\AbstractSchemaManager;
@@ -45,16 +44,10 @@ public function testCreateTransport()
4544
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
4645
$schemaManager = $this->createMock(AbstractSchemaManager::class);
4746
$schemaConfig = $this->createMock(SchemaConfig::class);
48-
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
49-
5047
$platform = $this->createMock(AbstractPlatform::class);
51-
$driver = $this->createMock(Driver::class);
52-
$driver->expects($this->once())
53-
->method('getDatabasePlatform')
54-
->willReturn($platform);
55-
48+
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
5649
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
57-
$driverConnection->method('getDriver')->willReturn($driver);
50+
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
5851
$registry = $this->createMock(ConnectionRegistry::class);
5952

6053
$registry->expects($this->once())
@@ -75,16 +68,10 @@ public function testCreateTransportNotifyWithPostgreSQLPlatform()
7568
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
7669
$schemaManager = $this->createMock(AbstractSchemaManager::class);
7770
$schemaConfig = $this->createMock(SchemaConfig::class);
78-
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
79-
8071
$platform = $this->createMock(PostgreSQLPlatform::class);
81-
$driver = $this->createMock(Driver::class);
82-
$driver->expects($this->once())
83-
->method('getDatabasePlatform')
84-
->willReturn($platform);
85-
72+
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
8673
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
87-
$driverConnection->method('getDriver')->willReturn($driver);
74+
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
8875
$registry = $this->createMock(ConnectionRegistry::class);
8976

9077
$registry->expects($this->once())

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
4848
throw new TransportException(sprintf('Could not find Doctrine connection from Messenger DSN "%s".', $dsn), 0, $e);
4949
}
5050

51-
if ($useNotify && $driverConnection->getDriver()->getDatabasePlatform() instanceof PostgreSQLPlatform) {
51+
if ($useNotify && $driverConnection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
5252
$connection = new PostgreSqlConnection($configuration, $driverConnection);
5353
} else {
5454
$connection = new Connection($configuration, $driverConnection);

0 commit comments

Comments
 (0)
0