File tree 2 files changed +86
-0
lines changed
src/Symfony/Component/VarDumper/Tests/Integration 2 files changed +86
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test integration with Symfony's DumpDataCollector
3
+ --FILE--
4
+ <?php
5
+ putenv ('NO_COLOR=1 ' );
6
+
7
+ $ vendor = __DIR__ ;
8
+ while (!file_exists ($ vendor .'/vendor ' )) {
9
+ $ vendor = \dirname ($ vendor );
10
+ }
11
+ require $ vendor .'/vendor/autoload.php ' ;
12
+
13
+ use Symfony \Component \HttpKernel \DataCollector \DumpDataCollector ;
14
+ use Symfony \Component \VarDumper \Cloner \VarCloner ;
15
+ use Symfony \Component \VarDumper \Dumper \CliDumper ;
16
+ use Symfony \Component \VarDumper \VarDumper ;
17
+
18
+ VarDumper::setHandler (function ($ var , string $ label = null ) {
19
+ $ dumper = new DumpDataCollector ();
20
+ $ cloner = new VarCloner ();
21
+ $ handler = function ($ var , string $ label = null ) use ($ dumper , $ cloner ) {
22
+ $ var = $ cloner ->cloneVar ($ var );
23
+ if (null !== $ label ) {
24
+ $ var = $ var ->withContext (['label ' => $ label ]);
25
+ }
26
+
27
+ $ dumper ->dump ($ var );
28
+ };
29
+ VarDumper::setHandler ($ handler );
30
+ $ handler ($ var , $ label );
31
+ });
32
+
33
+ $ schemas = new \ArrayObject ();
34
+ dump ($ schemas );
35
+ $ schemas ['X ' ] = new \ArrayObject (['type ' => 'object ' ]);
36
+
37
+ --EXPECTF --
38
+ ArrayObject {#%d
39
+ -storage: []
40
+ flag::STD_PROP_LIST : false
41
+ flag::ARRAY_AS_PROPS : false
42
+ iteratorClass: "ArrayIterator "
43
+ }
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test integration with Symfony's DumpDataCollector
3
+ --FILE--
4
+ <?php
5
+ putenv ('NO_COLOR=1 ' );
6
+
7
+ $ vendor = __DIR__ ;
8
+ while (!file_exists ($ vendor .'/vendor ' )) {
9
+ $ vendor = \dirname ($ vendor );
10
+ }
11
+ require $ vendor .'/vendor/autoload.php ' ;
12
+
13
+ use Symfony \Component \HttpKernel \DataCollector \DumpDataCollector ;
14
+ use Symfony \Component \VarDumper \Cloner \VarCloner ;
15
+ use Symfony \Component \VarDumper \Dumper \CliDumper ;
16
+ use Symfony \Component \VarDumper \VarDumper ;
17
+
18
+ VarDumper::setHandler (function ($ var , string $ label = null ) {
19
+ $ dumper = new DumpDataCollector ();
20
+ $ cloner = new VarCloner ();
21
+ $ handler = function ($ var , string $ label = null ) use ($ dumper , $ cloner ) {
22
+ $ var = $ cloner ->cloneVar ($ var );
23
+ if (null !== $ label ) {
24
+ $ var = $ var ->withContext (['label ' => $ label ]);
25
+ }
26
+
27
+ $ dumper ->dump ($ var );
28
+ };
29
+ VarDumper::setHandler ($ handler );
30
+ $ handler ($ var , $ label );
31
+ });
32
+
33
+ $ schemas = new \ArrayObject ();
34
+ dump ($ schemas );
35
+ $ schemas ['X ' ] = 'A ' ;
36
+
37
+ --EXPECTF --
38
+ ArrayObject {#%d
39
+ -storage: []
40
+ flag::STD_PROP_LIST : false
41
+ flag::ARRAY_AS_PROPS : false
42
+ iteratorClass: "ArrayIterator "
43
+ }
You can’t perform that action at this time.
0 commit comments