[3.1][PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation
This commit is contained in:
parent
a01cc6d8c4
commit
5735255467
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ErrorAssert;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
|
||||
use Symfony\Component\Cache\Adapter\ApcuAdapter;
|
||||
@ -547,16 +546,17 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
|
||||
* @expectedDeprecation The "framework.serializer.cache" option is deprecated %s.
|
||||
*/
|
||||
public function testDeprecatedSerializerCacheOption()
|
||||
{
|
||||
ErrorAssert::assertDeprecationsAreTriggered('The "framework.serializer.cache" option is deprecated', function () {
|
||||
$container = $this->createContainerFromFile('serializer_legacy_cache', array('kernel.debug' => true, 'kernel.container_class' => __CLASS__));
|
||||
$container = $this->createContainerFromFile('serializer_legacy_cache', array('kernel.debug' => true, 'kernel.container_class' => __CLASS__));
|
||||
|
||||
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
|
||||
$this->assertEquals(new Reference('foo'), $container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1));
|
||||
});
|
||||
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
|
||||
$this->assertTrue($container->hasDefinition('serializer.mapping.class_metadata_factory'));
|
||||
|
||||
$cache = $container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1);
|
||||
$this->assertEquals(new Reference('foo'), $cache);
|
||||
}
|
||||
|
||||
public function testAssetHelperWhenAssetsAreEnabled()
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ErrorAssert;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
|
||||
@ -86,17 +85,15 @@ class TemplateNameParserTest extends TestCase
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider provideAbsolutePaths
|
||||
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
|
||||
* @expectedDeprecation Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.
|
||||
*/
|
||||
public function testAbsolutePathsAreDeprecated($name, $logicalName, $path, $ref)
|
||||
{
|
||||
ErrorAssert::assertDeprecationsAreTriggered('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', function () use ($name, $logicalName, $path, $ref) {
|
||||
$template = $this->parser->parse($name);
|
||||
$template = $this->parser->parse($name);
|
||||
|
||||
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
|
||||
$this->assertSame($logicalName, $template->getLogicalName());
|
||||
$this->assertSame($path, $template->getPath());
|
||||
});
|
||||
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
|
||||
$this->assertSame($logicalName, $template->getLogicalName());
|
||||
$this->assertSame($path, $template->getPath());
|
||||
}
|
||||
|
||||
public function provideAbsolutePaths()
|
||||
|
@ -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;
|
||||
@ -59,18 +58,18 @@ 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->setDefinition('deprecated_foo', $definition);
|
||||
$builder->get('deprecated_foo');
|
||||
});
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->setDefinition('deprecated_foo', $definition);
|
||||
$builder->compile();
|
||||
$builder->get('deprecated_foo');
|
||||
}
|
||||
|
||||
public function testRegister()
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Tests\Loader;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ErrorAssert;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@ -558,23 +557,17 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
|
||||
* @expectedDeprecation Using the attribute "class" is deprecated for the service "bar" which is defined as an alias %s.
|
||||
* @expectedDeprecation Using the element "tag" is deprecated for the service "bar" which is defined as an alias %s.
|
||||
* @expectedDeprecation Using the element "factory" is deprecated for the service "bar" which is defined as an alias %s.
|
||||
*/
|
||||
public function testAliasDefinitionContainsUnsupportedElements()
|
||||
{
|
||||
$deprecations = array(
|
||||
'Using the attribute "class" is deprecated for the service "bar" which is defined as an alias',
|
||||
'Using the element "tag" is deprecated for the service "bar" which is defined as an alias',
|
||||
'Using the element "factory" is deprecated for the service "bar" which is defined as an alias',
|
||||
);
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
||||
|
||||
ErrorAssert::assertDeprecationsAreTriggered($deprecations, function () {
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
||||
$loader->load('legacy_invalid_alias_definition.xml');
|
||||
|
||||
$loader->load('legacy_invalid_alias_definition.xml');
|
||||
|
||||
$this->assertTrue($container->has('bar'));
|
||||
});
|
||||
$this->assertTrue($container->has('bar'));
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ErrorAssert;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
@ -28,16 +27,14 @@ class EsiFragmentRendererTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
|
||||
* @expectedDeprecation Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated %s.
|
||||
*/
|
||||
public function testRenderFallbackWithObjectAttributesIsDeprecated()
|
||||
{
|
||||
ErrorAssert::assertDeprecationsAreTriggered('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated', function () {
|
||||
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
|
||||
$request = Request::create('/');
|
||||
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
|
||||
$strategy->render($reference, $request);
|
||||
});
|
||||
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
|
||||
$request = Request::create('/');
|
||||
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
|
||||
$strategy->render($reference, $request);
|
||||
}
|
||||
|
||||
public function testRender()
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Yaml\Tests;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ErrorAssert;
|
||||
use Symfony\Component\Yaml\Inline;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
@ -255,14 +254,12 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
|
||||
* @expectedDeprecation Not quoting the scalar "%bar " starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.
|
||||
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
|
||||
*/
|
||||
public function testParseUnquotedScalarStartingWithPercentCharacter()
|
||||
{
|
||||
ErrorAssert::assertDeprecationsAreTriggered('Not quoting the scalar "%foo " starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', function () {
|
||||
Inline::parse('{ foo: %foo }');
|
||||
});
|
||||
Inline::parse('{ foo: %bar }');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user