15
15
use Symfony \Bundle \DebugBundle \DependencyInjection \DebugExtension ;
16
16
use Symfony \Component \DependencyInjection \ContainerBuilder ;
17
17
use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
18
+ use Symfony \Component \VarDumper \Caster \ReflectionCaster ;
18
19
19
20
class DebugExtensionTest extends TestCase
20
21
{
@@ -36,6 +37,39 @@ public function testLoadWithoutConfiguration()
36
37
$ this ->assertSame ($ expectedTags , $ container ->getDefinition ('data_collector.dump ' )->getTag ('data_collector ' ));
37
38
}
38
39
40
+ public function testUnsetClosureFileInfoShouldBeRegisteredInVarCloner ()
41
+ {
42
+ if (!method_exists (ReflectionCaster::class, 'unsetClosureFileInfo ' )) {
43
+ $ this ->markTestSkipped ('Method not available ' );
44
+ }
45
+
46
+ $ container = $ this ->createContainer ();
47
+ $ container ->registerExtension (new DebugExtension ());
48
+ $ container ->loadFromExtension ('debug ' , []);
49
+ $ this ->compileContainer ($ container );
50
+
51
+ $ definition = $ container ->getDefinition ('var_dumper.cloner ' );
52
+
53
+ $ called = false ;
54
+ foreach ($ definition ->getMethodCalls () as $ call ) {
55
+ if ('addCasters ' !== $ call [0 ]) {
56
+ continue ;
57
+ }
58
+
59
+ $ argument = $ call [1 ][0 ] ?? null ;
60
+ if (null === $ argument ) {
61
+ continue ;
62
+ }
63
+
64
+ if (['Closure ' => ReflectionCaster::class.'::unsetClosureFileInfo ' ] === $ argument ) {
65
+ $ called = true ;
66
+ break ;
67
+ }
68
+ }
69
+
70
+ $ this ->assertTrue ($ called );
71
+ }
72
+
39
73
private function createContainer ()
40
74
{
41
75
$ container = new ContainerBuilder (new ParameterBag ([
0 commit comments