1111
1212namespace Symfony \Component \HttpKernel \Tests \Fragment ;
1313
14+ use Symfony \Bridge \PhpUnit \ErrorAssert ;
1415use Symfony \Component \HttpKernel \Controller \ControllerReference ;
1516use Symfony \Component \HttpKernel \Fragment \EsiFragmentRenderer ;
1617use 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