Skip to content

Commit b330469

Browse files
Merge branch '3.1'
* 3.1: Tweak merge update tests to use the new error assertion helper [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev update tests to use the new error assertion helper Conflicts: src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
2 parents 033ba71 + aada9cf commit b330469

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

Tests/Fragment/EsiFragmentRendererTest.php

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

1212
namespace Symfony\Component\HttpKernel\Tests\Fragment;
1313

14+
use Symfony\Bridge\PhpUnit\ErrorAssert;
1415
use Symfony\Component\HttpKernel\Controller\ControllerReference;
1516
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
1617
use Symfony\Component\HttpKernel\HttpCache\Esi;
@@ -30,29 +31,12 @@ public function testRenderFallbackToInlineStrategyIfEsiNotSupported()
3031
*/
3132
public function testRenderFallbackWithObjectAttributesIsDeprecated()
3233
{
33-
$deprecations = array();
34-
set_error_handler(function ($type, $message) use (&$deprecations) {
35-
if (E_USER_DEPRECATED !== $type) {
36-
restore_error_handler();
37-
38-
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
39-
}
40-
41-
$deprecations[] = $message;
34+
ErrorAssert::assertDeprecationsAreTriggered('Passing objects as part of URI attributes to the ESI and SSI rendering strategies is deprecated', function () {
35+
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
36+
$request = Request::create('/');
37+
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
38+
$strategy->render($reference, $request);
4239
});
43-
44-
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
45-
46-
$request = Request::create('/');
47-
48-
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
49-
50-
$strategy->render($reference, $request);
51-
52-
restore_error_handler();
53-
54-
$this->assertCount(1, $deprecations);
55-
$this->assertContains('Passing objects as part of URI attributes to the ESI and SSI rendering strategies is deprecated', $deprecations[0]);
5640
}
5741

5842
public function testRender()

0 commit comments

Comments
 (0)