Skip to content

Commit d3d888f

Browse files
committed
Merge remote-tracking branch 'origin/2.17.x' into 3.0.x
2 parents f56b643 + e458c62 commit d3d888f

35 files changed

Lines changed: 118 additions & 52 deletions

tests/Command/CreateDatabaseDoctrineTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Doctrine\Bundle\DoctrineBundle\Tests\Command;
44

55
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
6+
use Doctrine\Bundle\DoctrineBundle\Tests\Polyfill\SymfonyApp;
67
use Doctrine\DBAL\Configuration;
78
use Doctrine\DBAL\Connection;
89
use Doctrine\DBAL\DriverManager;
910
use Doctrine\DBAL\Schema\SchemaManagerFactory;
1011
use Doctrine\Persistence\ManagerRegistry;
1112
use PHPUnit\Framework\MockObject\MockObject;
1213
use PHPUnit\Framework\TestCase;
13-
use Symfony\Component\Console\Application;
1414
use Symfony\Component\Console\Tester\CommandTester;
1515
use Symfony\Component\DependencyInjection\Container;
1616

@@ -37,8 +37,8 @@ public function testExecute(): void
3737

3838
$container = $this->getMockContainer($connectionName, $params);
3939

40-
$application = new Application();
41-
$application->add(new CreateDatabaseDoctrineCommand($container->get('doctrine')));
40+
$application = new SymfonyApp();
41+
$application->addCommand(new CreateDatabaseDoctrineCommand($container->get('doctrine')));
4242

4343
$command = $application->find('doctrine:database:create');
4444

tests/Command/DropDatabaseDoctrineTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Doctrine\Bundle\DoctrineBundle\Tests\Command;
44

55
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
6+
use Doctrine\Bundle\DoctrineBundle\Tests\Polyfill\SymfonyApp;
67
use Doctrine\DBAL\Configuration;
78
use Doctrine\DBAL\Connection;
89
use Doctrine\DBAL\DriverManager;
@@ -12,7 +13,6 @@
1213
use Generator;
1314
use PHPUnit\Framework\MockObject\MockObject;
1415
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Console\Application;
1616
use Symfony\Component\Console\Tester\CommandTester;
1717
use Symfony\Component\DependencyInjection\Container;
1818

@@ -41,8 +41,8 @@ public function testExecute(array $options): void
4141
/** @psalm-suppress InvalidArgument Need to be compatible with DBAL < 4, which still has `$params['url']` */
4242
$container = $this->getMockContainer($connectionName, $params);
4343

44-
$application = new Application();
45-
$application->add(new DropDatabaseDoctrineCommand($container->get('doctrine')));
44+
$application = new SymfonyApp();
45+
$application->addCommand(new DropDatabaseDoctrineCommand($container->get('doctrine')));
4646

4747
$command = $application->find('doctrine:database:drop');
4848

@@ -84,8 +84,8 @@ public function testExecuteWithoutOptionForceWillFailWithAttentionMessage(): voi
8484

8585
$container = $this->getMockContainer($connectionName, $params);
8686

87-
$application = new Application();
88-
$application->add(new DropDatabaseDoctrineCommand($container->get('doctrine')));
87+
$application = new SymfonyApp();
88+
$application->addCommand(new DropDatabaseDoctrineCommand($container->get('doctrine')));
8989

9090
$command = $application->find('doctrine:database:drop');
9191

@@ -108,7 +108,7 @@ public function testExecuteWithoutOptionForceWillFailWithAttentionMessage(): voi
108108
);
109109
}
110110

111-
public function provideForceOption(): Generator
111+
public static function provideForceOption(): Generator
112112
{
113113
yield 'full name' => [
114114
['--force' => true],
@@ -119,7 +119,7 @@ public function provideForceOption(): Generator
119119
];
120120
}
121121

122-
public function provideIncompatibleDriverOptions(): Generator
122+
public static function provideIncompatibleDriverOptions(): Generator
123123
{
124124
yield 'full name' => [
125125
[

tests/ConnectionFactoryTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testDefaultCharsetNonMySql(): void
4343
public function testDefaultCharsetMySql(): void
4444
{
4545
$factory = new ConnectionFactory([]);
46-
$params = ['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'];
46+
$params = ['driver' => 'pdo_mysql', 'serverVersion' => '9.4.0'];
4747

4848
$connection = $factory->createConnection($params, $this->configuration);
4949

@@ -53,7 +53,7 @@ public function testDefaultCharsetMySql(): void
5353
public function testDefaultCollationMySql(): void
5454
{
5555
$factory = new ConnectionFactory([]);
56-
$connection = $factory->createConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'], $this->configuration);
56+
$connection = $factory->createConnection(['driver' => 'pdo_mysql', 'serverVersion' => '9.4.0'], $this->configuration);
5757

5858
$this->assertSame(
5959
'utf8mb4_unicode_ci',
@@ -75,7 +75,7 @@ public function testConnectionOverrideOptions(): void
7575
/** @psalm-suppress InvalidArgument We should adjust when https://github.com/vimeo/psalm/issues/8984 is fixed */
7676
$connection = (new ConnectionFactory([]))->createConnection(
7777
[
78-
'url' => 'mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8',
78+
'url' => 'mysql://root:password@database:3306/main?serverVersion=mariadb-12.1.1',
7979
'connection_override_options' => $params,
8080
],
8181
$this->configuration,
@@ -100,7 +100,7 @@ public function testDbnameSuffix(): void
100100
/** @psalm-suppress InvalidArgument We should adjust when https://github.com/vimeo/psalm/issues/8984 is fixed */
101101
$connection = (new ConnectionFactory([]))->createConnection(
102102
[
103-
'url' => 'mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8',
103+
'url' => 'mysql://root:password@database:3306/main?serverVersion=mariadb-12.1.1',
104104
'dbname_suffix' => '_test',
105105
],
106106
$this->configuration,
@@ -115,13 +115,14 @@ public function testDbnameSuffixForReplicas(): void
115115
$connection = (new ConnectionFactory([]))->createConnection(
116116
[
117117
'driver' => 'pdo_mysql',
118+
'serverVersion' => '9.4.0',
118119
'primary' => [
119-
'url' => 'mysql://root:password@database:3306/primary?serverVersion=mariadb-10.5.8',
120+
'url' => 'mysql://root:password@database:3306/primary?serverVersion=mariadb-12.1.1',
120121
'dbname_suffix' => '_test',
121122
],
122123
'replica' => [
123124
'replica1' => [
124-
'url' => 'mysql://root:password@database:3306/replica?serverVersion=mariadb-10.5.8',
125+
'url' => 'mysql://root:password@database:3306/replica?serverVersion=mariadb-12.1.1',
125126
'dbname_suffix' => '_test',
126127
],
127128
],

tests/DependencyInjection/AbstractDoctrineExtensionTestCase.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function testDbalLoadFromXmlSingleConnections(): void
127127
$this->assertEquals('mysql_user', $config['user']);
128128
$this->assertEquals('mysql_db', $config['dbname']);
129129
$this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']);
130-
$this->assertEquals('5.6.20', $config['serverVersion']);
130+
$this->assertEquals('9.4.0', $config['serverVersion']);
131131
}
132132

133133
/** @group legacy */
@@ -136,7 +136,7 @@ public function testDbalLoadUrlOverride(): void
136136
$container = $this->loadContainer('dbal_allow_url_override');
137137
$config = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0);
138138

139-
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8', $config['url']);
139+
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-12.1.1', $config['url']);
140140

141141
$expectedOverrides = [
142142
'dbname' => 'main_test',
@@ -165,7 +165,7 @@ public function testDbalLoadPartialUrlOverrideSetsDefaults(): void
165165
];
166166

167167
$this->assertEquals($expectedDefaults, array_intersect_key($config, $expectedDefaults));
168-
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8', $config['url']);
168+
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-12.1.1', $config['url']);
169169
$this->assertCount(1, $config['connection_override_options']);
170170
$this->assertSame('main_test', $config['connection_override_options']['dbname']);
171171
$this->assertFalse(isset($config['override_url']));
@@ -176,7 +176,7 @@ public function testDbalDbnameSuffix(): void
176176
$container = $this->loadContainer('dbal_dbname_suffix');
177177
$config = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0);
178178

179-
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8', $config['url']);
179+
$this->assertSame('mysql://root:password@database:3306/main?serverVersion=mariadb-12.1.1', $config['url']);
180180
$this->assertSame('_test', $config['dbname_suffix']);
181181
}
182182

@@ -1293,6 +1293,7 @@ public function testDisableSchemaValidation(): void
12931293
$this->assertFalse($collectorDefinition->getArguments()[1]);
12941294
}
12951295

1296+
/** @group legacy */
12961297
public function testNativeLazyObjectsWithoutConfig(): void
12971298
{
12981299
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1317,6 +1318,7 @@ public function testNativeLazyObjectsWithConfigTrue(): void
13171318
$this->assertTrue($entityManager->getConfiguration()->isNativeLazyObjectsEnabled());
13181319
}
13191320

1321+
/** @group legacy */
13201322
public function testNativeLazyObjectsWithConfigFalse(): void
13211323
{
13221324
if (! interface_exists(EntityManagerInterface::class)) {

tests/DependencyInjection/Compiler/EntityListenerPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testEntityListenersAreRegistered(string|null $event, string|null
5757
}
5858

5959
/** @return iterable<array{0: ?string, 1: ?string, 2: ?string}> */
60-
public function provideEvents(): iterable
60+
public static function provideEvents(): iterable
6161
{
6262
yield 'With event and matching method' => [Events::prePersist, null, null];
6363
yield 'Without event' => [null, null, null];

tests/DependencyInjection/Compiler/MiddlewarePassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class MiddlewarePassTest extends TestCase
2626
{
2727
/** @return array<string, array{0: class-string, 1: bool}> */
28-
public function provideAddMiddleware(): array
28+
public static function provideAddMiddleware(): array
2929
{
3030
return [
3131
'not connection name aware' => [PHP7Middleware::class, false],
@@ -97,7 +97,7 @@ public function testAddMiddlewareWithAutoconfigure(): void
9797
}
9898

9999
/** @return array<string, array{0: class-string, 1: bool}> */
100-
public function provideAddMiddlewareWithAttributeForAutoconfiguration(): array
100+
public static function provideAddMiddlewareWithAttributeForAutoconfiguration(): array
101101
{
102102
return [
103103
'without specifying connection' => [AutoconfiguredMiddleware::class, true],

tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public function testOrmRequiresDbal(): void
251251
}
252252

253253
/** @return mixed[][][][] */
254-
public function getAutomappingConfigurations(): array
254+
public static function getAutomappingConfigurations(): array
255255
{
256256
return [
257257
[

tests/DependencyInjection/Fixtures/Bundles/AttributesBundle/Entity/Test.php renamed to tests/DependencyInjection/Fixtures/Bundles/AttributesBundle/Entity/TestClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
namespace Fixtures\Bundles\AttributesBundle\Entity;
44

5-
class Test
5+
class TestClass
66
{
77
}

tests/DependencyInjection/Fixtures/Bundles/NewXmlBundle/src/Entity/Test.php renamed to tests/DependencyInjection/Fixtures/Bundles/NewXmlBundle/src/Entity/TestClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
namespace Fixtures\Bundles\NewXmlBundle\Entity;
44

5-
class Test
5+
class TestClass
66
{
77
}

tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Entity/Test.php renamed to tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Entity/TestClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
namespace Fixtures\Bundles\XmlBundle\Entity;
44

5-
class Test
5+
class TestClass
66
{
77
}

0 commit comments

Comments
 (0)