minor #20269 [2.8][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[2.8][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

5d5f704 [2.8][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation
This commit is contained in:
Nicolas Grekas 2016-10-21 23:07:12 +02:00
commit a67242fe74
2 changed files with 10 additions and 16 deletions

View File

@ -14,7 +14,6 @@ namespace Symfony\Component\DependencyInjection\Tests;
require_once __DIR__.'/Fixtures/includes/classes.php';
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
use Symfony\Bridge\PhpUnit\ErrorAssert;
use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -61,17 +60,16 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
}
/**
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
* @group legacy
* @expectedDeprecation The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.
*/
public function testCreateDeprecatedService()
{
ErrorAssert::assertDeprecationsAreTriggered('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', function () {
$definition = new Definition('stdClass');
$definition->setDeprecated(true);
$definition = new Definition('stdClass');
$definition->setDeprecated(true);
$builder = new ContainerBuilder();
$builder->createService($definition, 'deprecated_foo');
});
$builder = new ContainerBuilder();
$builder->createService($definition, 'deprecated_foo');
}
public function testRegister()

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Yaml\Tests;
use Symfony\Bridge\PhpUnit\ErrorAssert;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Parser;
@ -927,19 +926,16 @@ EOF;
/**
* @group legacy
* @expectedDeprecation Using a colon in the unquoted mapping value "bar: baz" in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
* throw ParseException in Symfony 3.0
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testColonInMappingValueException()
{
$parser = $this->parser;
ErrorAssert::assertDeprecationsAreTriggered('Using a colon in the unquoted mapping value "bar: baz" in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', function () use ($parser) {
$yaml = <<<EOF
$yaml = <<<EOF
foo: bar: baz
EOF;
$parser->parse($yaml);
});
$this->parser->parse($yaml);
}
public function testColonInMappingValueExceptionNotTriggeredByColonInComment()