Skip to content

Commit af93ca2

Browse files
committed
Merge remote-tracking branch 'origin/2.17.x' into 3.0.x
2 parents d0be0f5 + d258ce9 commit af93ca2

5 files changed

Lines changed: 35 additions & 29 deletions

File tree

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@
4949
"phpstan/phpstan": "2.1.1",
5050
"phpstan/phpstan-phpunit": "2.0.3",
5151
"phpstan/phpstan-strict-rules": "^2",
52-
"phpunit/phpunit": "^9.6.22",
52+
"phpunit/phpunit": "^10.5.53",
5353
"psr/log": "^3.0",
5454
"symfony/doctrine-messenger": "^6.4 || ^7.0",
5555
"symfony/expression-language": "^6.4 || ^7.0",
5656
"symfony/messenger": "^6.4 || ^7.0",
57-
"symfony/phpunit-bridge": "^7.2",
5857
"symfony/property-info": "^6.4 || ^7.0",
5958
"symfony/security-bundle": "^6.4 || ^7.0",
6059
"symfony/stopwatch": "^6.4 || ^7.0",

phpunit.xml.dist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
colors="true"
44
bootstrap="tests/bootstrap.php"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
displayDetailsOnTestsThatTriggerDeprecations="true"
7+
failOnDeprecation="true"
68
>
79
<testsuites>
810
<testsuite name="DoctrineBundle for the Symfony Framework">
911
<directory>./tests</directory>
1012
</testsuite>
1113
</testsuites>
1214

13-
<coverage>
15+
<php>
16+
<env name="DOCTRINE_DEPRECATIONS" value="trigger"/>
17+
</php>
18+
19+
<source restrictDeprecations="true" ignoreSuppressionOfDeprecations="true">
1420
<include>
1521
<directory>src</directory>
1622
</include>
17-
</coverage>
18-
19-
<listeners>
20-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
21-
</listeners>
23+
</source>
2224
</phpunit>

tests/DependencyInjection/AbstractDoctrineExtensionTestCase.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use Generator;
1818
use InvalidArgumentException;
1919
use PDO;
20+
use PHPUnit\Framework\Attributes\DataProvider;
21+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2022
use PHPUnit\Framework\TestCase;
2123
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
2224
use Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator;
@@ -203,7 +205,7 @@ public function testDbalLoadDisableTypeComments(): void
203205
$this->assertCount(0, $calls);
204206
}
205207

206-
/** @group legacy */
208+
#[WithoutErrorHandler]
207209
public function testDbalSchemaManagerFactory(): void
208210
{
209211
$container = $this->loadContainer('dbal_schema_manager_factory');
@@ -623,10 +625,8 @@ public function testSetTypedFieldMapper(): void
623625
$this->assertDICDefinitionMethodCallOnce($definition, 'setTypedFieldMapper', [0 => new Reference('doctrine.orm.typed_field_mapper.default')]);
624626
}
625627

626-
/**
627-
* @dataProvider cacheConfigProvider
628-
* @group legacy
629-
*/
628+
#[DataProvider('cacheConfigProvider')]
629+
#[WithoutErrorHandler]
630630
public function testCacheConfig(string|null $expectedClass, string $entityManagerName, string|null $cacheGetter): void
631631
{
632632
if (! interface_exists(EntityManagerInterface::class)) {
@@ -990,7 +990,7 @@ public function testDbalSchemaFilterNewConfig(): void
990990
}
991991
}
992992

993-
/** @group legacy */
993+
#[WithoutErrorHandler]
994994
public function testWellKnownSchemaFilterDefaultTables(): void
995995
{
996996
$container = $this->getContainer([]);
@@ -1013,7 +1013,7 @@ public function testWellKnownSchemaFilterDefaultTables(): void
10131013
$this->assertTrue($filter->__invoke('anything_else'));
10141014
}
10151015

1016-
/** @group legacy */
1016+
#[WithoutErrorHandler]
10171017
public function testWellKnownSchemaFilterOverriddenTables(): void
10181018
{
10191019
$container = $this->getContainer([]);
@@ -1251,7 +1251,6 @@ public function testDisableSchemaValidation(): void
12511251
$this->assertFalse($collectorDefinition->getArguments()[1]);
12521252
}
12531253

1254-
/** @group legacy */
12551254
public function testNativeLazyObjectsWithoutConfig(): void
12561255
{
12571256
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1276,7 +1275,6 @@ public function testNativeLazyObjectsWithConfigTrue(): void
12761275
$this->assertTrue($entityManager->getConfiguration()->isNativeLazyObjectsEnabled());
12771276
}
12781277

1279-
/** @group legacy */
12801278
public function testNativeLazyObjectsWithConfigFalse(): void
12811279
{
12821280
if (! interface_exists(EntityManagerInterface::class)) {

tests/DependencyInjection/Compiler/EntityListenerPassTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use stdClass;
1313
use Symfony\Component\DependencyInjection\ContainerBuilder;
1414

15+
use function class_exists;
1516
use function interface_exists;
1617

1718
class EntityListenerPassTest extends TestCase
@@ -59,6 +60,13 @@ public function testEntityListenersAreRegistered(string|null $event, string|null
5960
/** @return iterable<array{0: ?string, 1: ?string, 2: ?string}> */
6061
public static function provideEvents(): iterable
6162
{
63+
if (! class_exists(Events::class)) {
64+
// If ORM is not available, return fake data to make the data provider valid
65+
yield 'Without ORM' => [null, null, null];
66+
67+
return;
68+
}
69+
6270
yield 'With event and matching method' => [Events::prePersist, null, null];
6371
yield 'Without event' => [null, null, null];
6472
yield 'With event and custom method' => [Events::postLoad, 'postLoadHandler', 'postLoadHandler'];

tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
3131
use InvalidArgumentException;
3232
use LogicException;
33+
use PHPUnit\Framework\Attributes\DataProvider;
34+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
3335
use PHPUnit\Framework\TestCase;
3436
use ReflectionClass;
3537
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
@@ -58,10 +60,10 @@
5860
class DoctrineExtensionTest extends TestCase
5961
{
6062
/**
61-
* https://github.com/doctrine/orm/pull/7953 needed, otherwise ORM classes we define services for trigger deprecations
62-
*
63-
* @group legacy
63+
* https://github.com/doctrine/orm/pull/7953 needed, otherwise ORM classes
64+
* we define services for trigger deprecations
6465
*/
66+
#[WithoutErrorHandler]
6567
public function testAutowiringAlias(): void
6668
{
6769
if (! interface_exists(EntityManagerInterface::class)) {
@@ -585,7 +587,7 @@ public function testSingleEntityManagerWithDefaultSecondLevelCacheConfiguration(
585587
$this->assertEquals('%doctrine.orm.second_level_cache.default_cache_factory.class%', $slcDefinition->getClass());
586588
}
587589

588-
/** @group legacy */
590+
#[WithoutErrorHandler]
589591
public function testSingleEntityManagerWithCustomSecondLevelCacheConfiguration(): void
590592
{
591593
if (! interface_exists(EntityManagerInterface::class)) {
@@ -870,7 +872,7 @@ public function testMessengerIntegrationWithoutDoctrineTransport(): void
870872
$this->assertNotContains('messenger.transport_factory', $container->findTags());
871873
}
872874

873-
/** @group legacy */
875+
#[WithoutErrorHandler]
874876
public function testInvalidCacheConfiguration(): void
875877
{
876878
if (! interface_exists(EntityManagerInterface::class)) {
@@ -917,12 +919,9 @@ public function testCacheConfiguration(string $expectedAliasName, string $expect
917919
$this->assertEquals($expectedTarget, (string) $alias);
918920
}
919921

920-
/**
921-
* @param array{type: ?string, pool?: string, id?: string} $cacheConfig
922-
*
923-
* @dataProvider legacyCacheConfigurationProvider
924-
* @group legacy
925-
*/
922+
/** @param array{type: ?string, pool?: string, id?: string} $cacheConfig */
923+
#[DataProvider('legacyCacheConfigurationProvider')]
924+
#[WithoutErrorHandler]
926925
public function testLegacyCacheConfiguration(string $expectedAliasName, string $expectedAliasTarget, string $cacheName, array $cacheConfig): void
927926
{
928927
$this->testCacheConfiguration($expectedAliasName, $expectedAliasTarget, $cacheName, $cacheConfig);

0 commit comments

Comments
 (0)