11
11
12
12
namespace Symfony \Component \HttpKernel \Tests \Fragment ;
13
13
14
+ use Symfony \Bridge \PhpUnit \ErrorAssert ;
14
15
use Symfony \Component \HttpKernel \Controller \ControllerReference ;
15
16
use Symfony \Component \HttpKernel \Fragment \EsiFragmentRenderer ;
16
17
use Symfony \Component \HttpKernel \HttpCache \Esi ;
@@ -30,29 +31,12 @@ public function testRenderFallbackToInlineStrategyIfEsiNotSupported()
30
31
*/
31
32
public function testRenderFallbackWithObjectAttributesIsDeprecated ()
32
33
{
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 );
42
39
});
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 ]);
56
40
}
57
41
58
42
public function testRender ()
0 commit comments