Skip to content

Commit 5edcf8b

Browse files
Merge branch '3.1'
* 3.1: [2.8][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation [3.1][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation
2 parents f0fbe38 + 2c08fd0 commit 5edcf8b

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

Tests/ContainerBuilderTest.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
require_once __DIR__.'/Fixtures/includes/classes.php';
1515
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
1616

17-
use Symfony\Bridge\PhpUnit\ErrorAssert;
1817
use Symfony\Component\Config\Resource\ResourceInterface;
1918
use Symfony\Component\DependencyInjection\Alias;
2019
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
@@ -60,19 +59,18 @@ public function testDefinitions()
6059
}
6160

6261
/**
63-
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
62+
* @group legacy
63+
* @expectedDeprecation The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.
6464
*/
6565
public function testCreateDeprecatedService()
6666
{
67-
ErrorAssert::assertDeprecationsAreTriggered('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', function () {
68-
$definition = new Definition('stdClass');
69-
$definition->setDeprecated(true);
67+
$definition = new Definition('stdClass');
68+
$definition->setDeprecated(true);
7069

71-
$builder = new ContainerBuilder();
72-
$builder->setDefinition('deprecated_foo', $definition);
73-
$builder->compile();
74-
$builder->get('deprecated_foo');
75-
});
70+
$builder = new ContainerBuilder();
71+
$builder->setDefinition('deprecated_foo', $definition);
72+
$builder->compile();
73+
$builder->get('deprecated_foo');
7674
}
7775

7876
public function testRegister()

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Tests\Loader;
1313

14-
use Symfony\Bridge\PhpUnit\ErrorAssert;
1514
use Symfony\Component\DependencyInjection\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\ContainerBuilder;
1716
use Symfony\Component\DependencyInjection\Reference;
@@ -558,23 +557,17 @@ public function testAutowire()
558557

559558
/**
560559
* @group legacy
561-
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
560+
* @expectedDeprecation Using the attribute "class" is deprecated for the service "bar" which is defined as an alias %s.
561+
* @expectedDeprecation Using the element "tag" is deprecated for the service "bar" which is defined as an alias %s.
562+
* @expectedDeprecation Using the element "factory" is deprecated for the service "bar" which is defined as an alias %s.
562563
*/
563564
public function testAliasDefinitionContainsUnsupportedElements()
564565
{
565-
$deprecations = array(
566-
'Using the attribute "class" is deprecated for the service "bar" which is defined as an alias',
567-
'Using the element "tag" is deprecated for the service "bar" which is defined as an alias',
568-
'Using the element "factory" is deprecated for the service "bar" which is defined as an alias',
569-
);
570-
571-
ErrorAssert::assertDeprecationsAreTriggered($deprecations, function () {
572-
$container = new ContainerBuilder();
573-
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
566+
$container = new ContainerBuilder();
567+
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
574568

575-
$loader->load('legacy_invalid_alias_definition.xml');
569+
$loader->load('legacy_invalid_alias_definition.xml');
576570

577-
$this->assertTrue($container->has('bar'));
578-
});
571+
$this->assertTrue($container->has('bar'));
579572
}
580573
}

0 commit comments

Comments
 (0)