1212namespace Symfony \Component \VarDumper \Tests \Command \Descriptor ;
1313
1414use PHPUnit \Framework \TestCase ;
15+ use Symfony \Component \Console \Formatter \OutputFormatterStyle ;
1516use Symfony \Component \Console \Output \BufferedOutput ;
1617use Symfony \Component\VarDumper \Cloner \Data ;
1718use Symfony \Component \VarDumper \Command \Descriptor \CliDescriptor ;
@@ -35,9 +36,10 @@ public static function tearDownAfterClass()
3536 /**
3637 * @dataProvider provideContext
3738 */
38- public function testDescribe (array $ context , string $ expectedOutput )
39+ public function testDescribe (array $ context , string $ expectedOutput, bool $ decorated = false )
3940 {
4041 $ output = new BufferedOutput ();
42+ $ output ->setDecorated ($ decorated );
4143 $ descriptor = new CliDescriptor (new CliDumper (function ($ s ) {
4244 return $ s ;
4345 }));
@@ -79,7 +81,8 @@ public function provideContext()
7981 'file_link ' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30 ' ,
8082 ),
8183 ),
82- <<<TXT
84+ method_exists (OutputFormatterStyle::class, 'setHref ' ) ?
85+ <<<TXT
8386Received from client #1
8487-----------------------
8588
@@ -88,9 +91,43 @@ public function provideContext()
8891 source CliDescriptorTest.php on line 30
8992 file src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
9093 -------- --------------------------------------------------------------------------------
94+
95+ TXT
96+ :
97+ <<<TXT
98+ Received from client #1
99+ -----------------------
100+
101+ -------- --------------------------------------------------------------------------------
102+ date Fri, 14 Dec 2018 16:17:48 +0000
103+ source CliDescriptorTest.php on line 30
104+ file src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
105+ -------- --------------------------------------------------------------------------------
106+
107+ Open source in your IDE/browser:
108+ phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30
91109TXT
92110 );
93111
112+ if (method_exists (OutputFormatterStyle::class, 'setHref ' )) {
113+ yield 'source with hyperlink ' => array (
114+ array (
115+ 'source ' => array (
116+ 'name ' => 'CliDescriptorTest.php ' ,
117+ 'line ' => 30 ,
118+ 'file_relative ' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php ' ,
119+ 'file_link ' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30 ' ,
120+ )
121+ ),
122+ <<<TXT
123+ %A
124+ source \033]8;;phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30 \033\CliDescriptorTest.php on line 30 \033]8;; \033%A
125+ %A
126+ TXT
127+ , true
128+ );
129+ }
130+
94131 yield 'cli ' => array (
95132 array (
96133 'cli ' => array (
0 commit comments