Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58843f3

Browse filesBrowse files
committed
Remove check on getSchemaManager
1 parent b1c2e56 commit 58843f3
Copy full SHA for 58843f3

File tree

3 files changed

+27
-4
lines changed
Filter options

3 files changed

+27
-4
lines changed

‎src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Doctrine\DBAL\Driver\Statement;
1616
use Doctrine\DBAL\Platforms\AbstractPlatform;
1717
use Doctrine\DBAL\Query\QueryBuilder;
18+
use Doctrine\DBAL\Schema\AbstractSchemaManager;
19+
use Doctrine\DBAL\Schema\SchemaConfig;
1820
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
1921
use PHPUnit\Framework\TestCase;
2022
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
@@ -113,6 +115,17 @@ private function getDBALConnectionMock()
113115
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
114116
$driverConnection->method('getConfiguration')->willReturn($configuration);
115117

118+
$schemaManager = $this->getMockBuilder(AbstractSchemaManager::class)
119+
->disableOriginalConstructor()
120+
->getMock();
121+
$schemaConfig = $this->getMockBuilder(SchemaConfig::class)
122+
->disableOriginalConstructor()
123+
->getMock();
124+
$schemaConfig->method('getMaxIdentifierLength')->willReturn(63);
125+
$schemaConfig->method('getDefaultTableOptions')->willReturn([]);
126+
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
127+
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
128+
116129
return $driverConnection;
117130
}
118131

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Transport/Doctrine/DoctrineTransportFactoryTest.php
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

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

14+
use Doctrine\DBAL\Schema\AbstractSchemaManager;
15+
use Doctrine\DBAL\Schema\SchemaConfig;
1416
use PHPUnit\Framework\TestCase;
1517
use Symfony\Bridge\Doctrine\RegistryInterface;
1618
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
@@ -32,19 +34,27 @@ public function testSupports()
3234

3335
public function testCreateTransport()
3436
{
35-
$connection = $this->getMockBuilder(\Doctrine\DBAL\Connection::class)
37+
$driverConnection = $this->getMockBuilder(\Doctrine\DBAL\Connection::class)
3638
->disableOriginalConstructor()
3739
->getMock();
40+
$schemaManager = $this->getMockBuilder(AbstractSchemaManager::class)
41+
->disableOriginalConstructor()
42+
->getMock();
43+
$schemaConfig = $this->getMockBuilder(SchemaConfig::class)
44+
->disableOriginalConstructor()
45+
->getMock();
46+
$schemaManager->method('createSchemaConfig')->willReturn($schemaConfig);
47+
$driverConnection->method('getSchemaManager')->willReturn($schemaManager);
3848
$registry = $this->getMockBuilder(RegistryInterface::class)->getMock();
3949
$registry->expects($this->once())
4050
->method('getConnection')
41-
->willReturn($connection);
51+
->willReturn($driverConnection);
4252

4353
$factory = new DoctrineTransportFactory($registry);
4454
$serializer = $this->createMock(SerializerInterface::class);
4555

4656
$this->assertEquals(
47-
new DoctrineTransport(new Connection(Connection::buildConfiguration('doctrine://default'), $connection), $serializer),
57+
new DoctrineTransport(new Connection(Connection::buildConfiguration('doctrine://default'), $driverConnection), $serializer),
4858
$factory->createTransport('doctrine://default', [], $serializer)
4959
);
5060
}

‎src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(array $configuration, DBALConnection $driverConnecti
6060
$this->configuration = array_replace_recursive(self::DEFAULT_OPTIONS, $configuration);
6161
$this->driverConnection = $driverConnection;
6262
$this->schemaSynchronizer = $schemaSynchronizer ?? new SingleDatabaseSynchronizer($this->driverConnection);
63-
$this->schemaConfig = $schemaConfig ?? ($this->driverConnection->getSchemaManager() ? $this->driverConnection->getSchemaManager()->createSchemaConfig() : null);
63+
$this->schemaConfig = $schemaConfig ?? $this->driverConnection->getSchemaManager()->createSchemaConfig();
6464
}
6565

6666
public function getConfiguration(): array

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.