File tree 2 files changed +6
-3
lines changed
src/Symfony/Component/Console
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface
23
23
/**
24
24
* The pattern to phrase the format.
25
25
*/
26
- const FORMAT_PATTERN = '#( \\\\?)<(/?)([a-z][a-z0-9_=;-]+ )?>((?: [^< \\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<= \\\\<) )*)#isx ' ;
26
+ const FORMAT_PATTERN = '#( \\\\?)<(/?)([a-z][a-z0-9_=;-]* )?>((?: [^< \\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<= \\\\<) )*)#isx ' ;
27
27
28
28
private $ decorated ;
29
29
private $ styles = array ();
Original file line number Diff line number Diff line change @@ -113,7 +113,10 @@ public function testNewStyle()
113
113
$ this ->assertEquals ($ style , $ formatter ->getStyle ('test ' ));
114
114
$ this ->assertNotEquals ($ style , $ formatter ->getStyle ('info ' ));
115
115
116
- $ this ->assertEquals ("\033[34;47msome custom msg \033[0m " , $ formatter ->format ('<test>some custom msg</test> ' ));
116
+ $ style = new OutputFormatterStyle ('blue ' , 'white ' );
117
+ $ formatter ->setStyle ('b ' , $ style );
118
+
119
+ $ this ->assertEquals ("\033[34;47msome \033[0m \033[34;47mcustom \033[0m \033[34;47m msg \033[0m " , $ formatter ->format ('<test>some <b>custom</b> msg</test> ' ));
117
120
}
118
121
119
122
public function testRedefineStyle ()
@@ -137,7 +140,7 @@ public function testInlineStyle()
137
140
public function testNonStyleTag ()
138
141
{
139
142
$ formatter = new OutputFormatter (true );
140
- $ this ->assertEquals ("\033[32msome \033[0m \033[32m<tag> styled \033[0m " , $ formatter ->format ('<info>some <tag> styled</info> ' ));
143
+ $ this ->assertEquals ("\033[32msome \033[0m \033[32m<tag> styled \033[0m \033 [32m<p>single-char tag \033 [0m \033 [32m</p> \033 [0m " , $ formatter ->format ('<info>some <tag> styled <p>single-char tag</p> </info> ' ));
141
144
}
142
145
143
146
public function testNotDecoratedFormatter ()
You can’t perform that action at this time.
0 commit comments