Skip to content

Commit

Permalink
minor #20269 [2.8][PhpUnitBridge] Drop ErrorAssert in favor of @expec…
Browse files Browse the repository at this point in the history
…tedDeprecation (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
  • Loading branch information
nicolas-grekas committed Oct 21, 2016
2 parents 5a08a32 + 5d5f704 commit a67242f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Expand Up @@ -14,7 +14,6 @@
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;
Expand Down Expand Up @@ -61,17 +60,16 @@ public function testDefinitions()
}

/**
* @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()
Expand Down
12 changes: 4 additions & 8 deletions src/Symfony/Component/Yaml/Tests/ParserTest.php
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Yaml\Tests;

use Symfony\Bridge\PhpUnit\ErrorAssert;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Parser;

Expand Down Expand Up @@ -927,19 +926,16 @@ public function testFloatKeys()

/**
* @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()
Expand Down

0 comments on commit a67242f

Please sign in to comment.