|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
15 | 15 | use Psr\Container\ContainerInterface;
|
| 16 | +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; |
16 | 17 | use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
17 | 18 | use Symfony\Component\Config\FileLocator;
|
18 | 19 | use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
|
|
49 | 50 |
|
50 | 51 | class PhpDumperTest extends TestCase
|
51 | 52 | {
|
| 53 | + use ExpectDeprecationTrait; |
| 54 | + |
52 | 55 | protected static $fixturesPath;
|
53 | 56 |
|
54 | 57 | public static function setUpBeforeClass(): void
|
@@ -410,10 +413,10 @@ public function testAliases()
|
410 | 413 |
|
411 | 414 | /**
|
412 | 415 | * @group legacy
|
413 |
| - * @expectedDeprecation The "alias_for_foo_deprecated" service alias is deprecated. You should stop using it, as it will be removed in the future. |
414 | 416 | */
|
415 | 417 | public function testAliasesDeprecation()
|
416 | 418 | {
|
| 419 | + $this->expectDeprecation('The "alias_for_foo_deprecated" service alias is deprecated. You should stop using it, as it will be removed in the future.'); |
417 | 420 | $container = include self::$fixturesPath.'/containers/container_alias_deprecation.php';
|
418 | 421 | $container->compile();
|
419 | 422 | $dumper = new PhpDumper($container);
|
@@ -1192,10 +1195,10 @@ public function testAdawsonContainer()
|
1192 | 1195 | * This test checks the trigger of a deprecation note and should not be removed in major releases.
|
1193 | 1196 | *
|
1194 | 1197 | * @group legacy
|
1195 |
| - * @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will be removed in the future. |
1196 | 1198 | */
|
1197 | 1199 | public function testPrivateServiceTriggersDeprecation()
|
1198 | 1200 | {
|
| 1201 | + $this->expectDeprecation('The "foo" service is deprecated. You should stop using it, as it will be removed in the future.'); |
1199 | 1202 | $container = new ContainerBuilder();
|
1200 | 1203 | $container->register('foo', 'stdClass')
|
1201 | 1204 | ->setPublic(false)
|
@@ -1344,11 +1347,11 @@ public function testWither()
|
1344 | 1347 |
|
1345 | 1348 | /**
|
1346 | 1349 | * @group legacy
|
1347 |
| - * @expectedDeprecation The "deprecated1" service alias is deprecated. You should stop using it, as it will be removed in the future. |
1348 |
| - * @expectedDeprecation The "deprecated2" service alias is deprecated. You should stop using it, as it will be removed in the future. |
1349 | 1350 | */
|
1350 | 1351 | public function testMultipleDeprecatedAliasesWorking()
|
1351 | 1352 | {
|
| 1353 | + $this->expectDeprecation('The "deprecated1" service alias is deprecated. You should stop using it, as it will be removed in the future.'); |
| 1354 | + $this->expectDeprecation('The "deprecated2" service alias is deprecated. You should stop using it, as it will be removed in the future.'); |
1352 | 1355 | $container = new ContainerBuilder();
|
1353 | 1356 | $container->setDefinition('bar', new Definition('stdClass'))->setPublic(true);
|
1354 | 1357 | $container->setAlias('deprecated1', 'bar')->setPublic(true)->setDeprecated('%alias_id% is deprecated');
|
|
0 commit comments