12
12
namespace Symfony \Component \VarDumper \Tests \Command \Descriptor ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Component \Console \Formatter \OutputFormatterStyle ;
15
16
use Symfony \Component \Console \Output \BufferedOutput ;
16
17
use Symfony \Component \VarDumper \Cloner \Data ;
17
18
use Symfony \Component \VarDumper \Command \Descriptor \CliDescriptor ;
@@ -35,9 +36,10 @@ public static function tearDownAfterClass()
35
36
/**
36
37
* @dataProvider provideContext
37
38
*/
38
- public function testDescribe (array $ context , string $ expectedOutput )
39
+ public function testDescribe (array $ context , string $ expectedOutput, bool $ decorated = false )
39
40
{
40
41
$ output = new BufferedOutput ();
42
+ $ output ->setDecorated ($ decorated );
41
43
$ descriptor = new CliDescriptor (new CliDumper (function ($ s ) {
42
44
return $ s ;
43
45
}));
@@ -79,7 +81,20 @@ public function provideContext()
79
81
'file_link ' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30 ' ,
80
82
)
81
83
),
82
- <<<TXT
84
+ method_exists (OutputFormatterStyle::class, 'setHref ' ) ?
85
+ <<<TXT
86
+ Received from client #1
87
+ -----------------------
88
+
89
+ -------- --------------------------------------------------------------------------------
90
+ date Fri, 14 Dec 2018 16:17:48 +0000
91
+ source CliDescriptorTest.php on line 30
92
+ file src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
93
+ -------- --------------------------------------------------------------------------------
94
+
95
+ TXT
96
+ :
97
+ <<<TXT
83
98
Received from client #1
84
99
-----------------------
85
100
@@ -94,6 +109,25 @@ public function provideContext()
94
109
TXT
95
110
);
96
111
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
+
97
131
yield 'cli ' => array (
98
132
array (
99
133
'cli ' => array (
0 commit comments