Skip to content

Commit 20e18d4

Browse files
committed
favor #[IgnoreDeprecations] over #[WithoutErrorHandler]
1 parent c9ecb14 commit 20e18d4

9 files changed

Lines changed: 35 additions & 33 deletions

tests/Command/ImportMappingDoctrineCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Doctrine\ORM\EntityManagerInterface;
77
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
88
use InvalidArgumentException;
9-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
9+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1010
use PHPUnit\Framework\TestCase;
1111
use Symfony\Bundle\FrameworkBundle\Console\Application;
1212
use Symfony\Component\Console\Tester\CommandTester;
@@ -66,7 +66,7 @@ protected function tearDown(): void
6666
unset($this->kernel, $this->commandTester);
6767
}
6868

69-
#[WithoutErrorHandler]
69+
#[IgnoreDeprecations]
7070
public function testExecuteXmlWithBundle(): void
7171
{
7272
$this->commandTester->execute(['name' => 'ImportMappingTestFooBundle']);
@@ -80,7 +80,7 @@ public function testExecuteXmlWithBundle(): void
8080
);
8181
}
8282

83-
#[WithoutErrorHandler]
83+
#[IgnoreDeprecations]
8484
public function testExecuteAnnotationsWithBundle(): void
8585
{
8686
$this->commandTester->execute([
@@ -97,15 +97,15 @@ public function testExecuteAnnotationsWithBundle(): void
9797
);
9898
}
9999

100-
#[WithoutErrorHandler]
100+
#[IgnoreDeprecations]
101101
public function testExecuteThrowsExceptionWithNamespaceAndNoPath(): void
102102
{
103103
$this->expectException(InvalidArgumentException::class);
104104
$this->expectExceptionMessage('The --path option is required');
105105
$this->commandTester->execute(['name' => 'Some\Namespace']);
106106
}
107107

108-
#[WithoutErrorHandler]
108+
#[IgnoreDeprecations]
109109
public function testExecuteXmlWithNamespace(): void
110110
{
111111
$this->commandTester->execute([
@@ -122,7 +122,7 @@ public function testExecuteXmlWithNamespace(): void
122122
);
123123
}
124124

125-
#[WithoutErrorHandler]
125+
#[IgnoreDeprecations]
126126
public function testExecuteAnnotationsWithNamespace(): void
127127
{
128128
$this->commandTester->execute([

tests/ConnectionFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Doctrine\DBAL\Driver;
99
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
1010
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
11-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
11+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1212

1313
use function array_intersect_key;
1414

@@ -62,7 +62,7 @@ public function testDefaultCollationMySql(): void
6262
);
6363
}
6464

65-
#[WithoutErrorHandler]
65+
#[IgnoreDeprecations]
6666
public function testCollateMapsToCollationForMySql(): void
6767
{
6868
$factory = new ConnectionFactory([]);
@@ -86,7 +86,7 @@ public function testCollateMapsToCollationForMySql(): void
8686
);
8787
}
8888

89-
#[WithoutErrorHandler]
89+
#[IgnoreDeprecations]
9090
public function testConnectionOverrideOptions(): void
9191
{
9292
$params = [

tests/DependencyInjection/AbstractDoctrineExtensionTestCase.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
use LogicException;
2828
use PDO;
2929
use PHPUnit\Framework\Attributes\DataProvider;
30-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
30+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
3131
use PHPUnit\Framework\TestCase;
3232
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
3333
use Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator;
@@ -145,7 +145,7 @@ public function testDbalLoadFromXmlSingleConnections(): void
145145
$this->assertEquals('9.4.0', $config['serverVersion']);
146146
}
147147

148-
#[WithoutErrorHandler]
148+
#[IgnoreDeprecations]
149149
public function testDbalLoadUrlOverride(): void
150150
{
151151
$container = $this->loadContainer('dbal_allow_url_override');
@@ -166,7 +166,7 @@ public function testDbalLoadUrlOverride(): void
166166
$this->assertFalse(isset($config['override_url']));
167167
}
168168

169-
#[WithoutErrorHandler]
169+
#[IgnoreDeprecations]
170170
public function testDbalLoadPartialUrlOverrideSetsDefaults(): void
171171
{
172172
$container = $this->loadContainer('dbal_allow_partial_url_override');
@@ -280,7 +280,7 @@ public function testDbalLoadDisableTypeComments(): void
280280
$this->assertCount(0, $calls);
281281
}
282282

283-
#[WithoutErrorHandler]
283+
#[IgnoreDeprecations]
284284
public function testDbalSchemaManagerFactory(): void
285285
{
286286
$container = $this->loadContainer('dbal_schema_manager_factory');
@@ -720,7 +720,7 @@ public function testSetTypedFieldMapper(): void
720720
}
721721

722722
#[DataProvider('cacheConfigProvider')]
723-
#[WithoutErrorHandler]
723+
#[IgnoreDeprecations]
724724
public function testCacheConfig(string|null $expectedClass, string $entityManagerName, string|null $cacheGetter): void
725725
{
726726
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1168,7 +1168,7 @@ public function testDbalSchemaFilterNewConfig(): void
11681168
}
11691169
}
11701170

1171-
#[WithoutErrorHandler]
1171+
#[IgnoreDeprecations]
11721172
public function testWellKnownSchemaFilterDefaultTables(): void
11731173
{
11741174
$container = $this->getContainer([]);
@@ -1191,7 +1191,7 @@ public function testWellKnownSchemaFilterDefaultTables(): void
11911191
$this->assertTrue($filter->__invoke('anything_else'));
11921192
}
11931193

1194-
#[WithoutErrorHandler]
1194+
#[IgnoreDeprecations]
11951195
public function testWellKnownSchemaFilterOverriddenTables(): void
11961196
{
11971197
$container = $this->getContainer([]);
@@ -1429,7 +1429,7 @@ public function testDisableSchemaValidation(): void
14291429
$this->assertFalse($collectorDefinition->getArguments()[1]);
14301430
}
14311431

1432-
#[WithoutErrorHandler]
1432+
#[IgnoreDeprecations]
14331433
public function testNativeLazyObjectsWithoutConfig(): void
14341434
{
14351435
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1470,7 +1470,7 @@ public function testNativeLazyObjectsWithConfigTrue(): void
14701470
$this->assertTrue($entityManager->getConfiguration()->isNativeLazyObjectsEnabled());
14711471
}
14721472

1473-
#[WithoutErrorHandler]
1473+
#[IgnoreDeprecations]
14741474
public function testNativeLazyObjectsWithConfigFalse(): void
14751475
{
14761476
if (! interface_exists(EntityManagerInterface::class)) {

tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Doctrine\ORM\Cache\Region;
1010
use Doctrine\ORM\EntityManagerInterface;
1111
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
12-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
12+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1313
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1414
use Symfony\Component\Config\Loader\LoaderInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -108,7 +108,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
108108
})->boot();
109109
}
110110

111-
#[WithoutErrorHandler]
111+
#[IgnoreDeprecations]
112112
public function testMetadataCacheConfigUsingNonPsr6ServiceDefinedByApplication(): void
113113
{
114114
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/DoctrineBundle/pull/1365');

tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
use InvalidArgumentException;
4040
use LogicException;
4141
use PHPUnit\Framework\Attributes\DataProvider;
42+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
4243
use PHPUnit\Framework\Attributes\RequiresMethod;
4344
use PHPUnit\Framework\Attributes\TestWith;
44-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
4545
use PHPUnit\Framework\TestCase;
4646
use ReflectionClass;
4747
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
@@ -75,7 +75,7 @@ class DoctrineExtensionTest extends TestCase
7575
* https://github.com/doctrine/orm/pull/7953 needed, otherwise ORM classes
7676
* we define services for trigger deprecations
7777
*/
78-
#[WithoutErrorHandler]
78+
#[IgnoreDeprecations]
7979
public function testAutowiringAlias(): void
8080
{
8181
if (! interface_exists(EntityManagerInterface::class)) {
@@ -657,7 +657,7 @@ public function testSingleEntityManagerWithDefaultSecondLevelCacheConfiguration(
657657
$this->assertEquals('%doctrine.orm.second_level_cache.default_cache_factory.class%', $slcDefinition->getClass());
658658
}
659659

660-
#[WithoutErrorHandler]
660+
#[IgnoreDeprecations]
661661
public function testSingleEntityManagerWithCustomSecondLevelCacheConfiguration(): void
662662
{
663663
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1020,7 +1020,7 @@ public function testMessengerIntegrationWithoutDoctrineTransport(): void
10201020
$this->assertNotContains('messenger.transport_factory', $container->findTags());
10211021
}
10221022

1023-
#[WithoutErrorHandler]
1023+
#[IgnoreDeprecations]
10241024
public function testInvalidCacheConfiguration(): void
10251025
{
10261026
if (! interface_exists(EntityManagerInterface::class)) {
@@ -1066,7 +1066,7 @@ public function testCacheConfiguration(string $expectedAliasName, string $expect
10661066

10671067
/** @param array{type: ?string, pool?: string, id?: string} $cacheConfig */
10681068
#[DataProvider('legacyCacheConfigurationProvider')]
1069-
#[WithoutErrorHandler]
1069+
#[IgnoreDeprecations]
10701070
public function testLegacyCacheConfiguration(string $expectedAliasName, string $expectedAliasTarget, string $cacheName, array $cacheConfig): void
10711071
{
10721072
$this->testCacheConfiguration($expectedAliasName, $expectedAliasTarget, $cacheName, $cacheConfig);

tests/LockStoreSchemaListenerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
66
use Doctrine\ORM\EntityManagerInterface;
7+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
78
use PHPUnit\Framework\Attributes\TestWith;
89
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
910
use Symfony\Component\DependencyInjection\Alias;
@@ -18,6 +19,7 @@ class LockStoreSchemaListenerTest extends TestCase
1819
/** @param array<string, mixed> $config */
1920
#[TestWith([[], 0])]
2021
#[TestWith([['lock' => 'flock'], 1])]
22+
#[IgnoreDeprecations]
2123
public function testLockStoreSchemaSubscriberWiring(array $config, int $expectedCount): void
2224
{
2325
if (! interface_exists(EntityManagerInterface::class)) {

tests/RegistryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Fixtures\Bundles\RepositoryServiceBundle\Entity\TestCustomClassRepoEntity;
1212
use Fixtures\Bundles\RepositoryServiceBundle\Repository\TestCustomClassRepoRepository;
1313
use InvalidArgumentException;
14+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1415
use PHPUnit\Framework\Attributes\RequiresPhp;
15-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
1616
use ProxyManager\Proxy\ProxyInterface;
1717
use Symfony\Component\DependencyInjection\Container;
1818
use Symfony\Component\VarExporter\LazyObjectInterface;
@@ -120,7 +120,7 @@ public function testResetUnknownEntityManager(): void
120120
$registry->resetManager('default');
121121
}
122122

123-
#[WithoutErrorHandler]
123+
#[IgnoreDeprecations]
124124
#[RequiresPhp('<8.4')]
125125
public function testReset(): void
126126
{

tests/Twig/DoctrineExtensionTest.php

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

55
use Doctrine\Bundle\DoctrineBundle\Twig\DoctrineExtension;
6-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
6+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
77
use PHPUnit\Framework\TestCase;
88

99
use function pack;
@@ -104,7 +104,7 @@ public function testEscapeBooleanParameter(): void
104104
$this->assertEquals('1', DoctrineExtension::escapeFunction(true));
105105
}
106106

107-
#[WithoutErrorHandler]
107+
#[IgnoreDeprecations]
108108
public function testItHighlightsSqlQueriesUsingCssClasses(): void
109109
{
110110
$extension = new DoctrineExtension();
@@ -118,7 +118,7 @@ public function testItHighlightsSqlQueriesUsingCssClasses(): void
118118
);
119119
}
120120

121-
#[WithoutErrorHandler]
121+
#[IgnoreDeprecations]
122122
public function testItDoesNotOutputDuplicatePreTags(): void
123123
{
124124
$extension = new DoctrineExtension();
@@ -132,7 +132,7 @@ public function testItDoesNotOutputDuplicatePreTags(): void
132132
);
133133
}
134134

135-
#[WithoutErrorHandler]
135+
#[IgnoreDeprecations]
136136
public function testItUsesCssOnTheDivTag(): void
137137
{
138138
$extension = new DoctrineExtension();

tests/UrlOverrideTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures\DbalTestKernel;
66
use PHPUnit\Framework\Attributes\DataProvider;
7-
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
7+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
88

99
use function array_intersect_key;
1010

@@ -14,7 +14,7 @@ class UrlOverrideTest extends TestCase
1414
* @param array<string, (bool|string|null)> $config
1515
* @param array<string, (bool|string|null)> $expectedParams
1616
*/
17-
#[WithoutErrorHandler]
17+
#[IgnoreDeprecations]
1818
#[DataProvider('connectionDataProvider')]
1919
public function testConnectionConfiguration(array $config, array $expectedParams): void
2020
{

0 commit comments

Comments
 (0)