File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Filter options
src/Symfony/Component/VarDumper/Tests/Dumper Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Component \VarDumper \Tests \Dumper ;
13
+
14
+ use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Component \VarDumper \Cloner \VarCloner ;
16
+ use Symfony \Component \VarDumper \Dumper \CliDumper ;
17
+ use Symfony \Component \VarDumper \VarDumper ;
18
+
19
+ class FunctionsTest extends TestCase
20
+ {
21
+ public function testDumpReturnsFirstArg ()
22
+ {
23
+ $ this ->setupVarDumper ();
24
+
25
+ $ var1 = 'a ' ;
26
+
27
+ ob_start ();
28
+ $ return = dump ($ var1 );
29
+ $ out = ob_get_clean ();
30
+
31
+ $ this ->assertEquals ($ var1 , $ return );
32
+ }
33
+
34
+ public function testDumpReturnsAllArgsInArray ()
35
+ {
36
+ $ this ->setupVarDumper ();
37
+
38
+ $ var1 = 'a ' ;
39
+ $ var2 = 'b ' ;
40
+ $ var3 = 'c ' ;
41
+
42
+ ob_start ();
43
+ $ return = dump ($ var1 , $ var2 , $ var3 );
44
+ $ out = ob_get_clean ();
45
+
46
+ $ this ->assertEquals (array ($ var1 , $ var2 , $ var3 ), $ return );
47
+ }
48
+
49
+ protected function setupVarDumper ()
50
+ {
51
+ $ cloner = new VarCloner ();
52
+ $ dumper = new CliDumper ('php://output ' );
53
+ VarDumper::setHandler (function ($ var ) use ($ cloner , $ dumper ) {
54
+ $ dumper ->dump ($ cloner ->cloneVar ($ var ));
55
+ });
56
+ }
57
+ }
You can’t perform that action at this time.
0 commit comments