Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 2.7+ |
I'm not sure how to write a test for this, as I don't know the best way to test for colors in the console component, but here's an example that shows the behavior that I'm talking about:
'Header with comment style' => array(
array(
new TableCell('<comment>Long Title</comment>', array('colspan' => 3)),
),
array(
array(
new TableCell('9971-5-0210-0', array('colspan' => 3)),
),
new TableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+
| Long Title |
+------------------+---------+------------------+
| 9971-5-0210-0 |
+------------------+---------+------------------+
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+------------------+---------+------------------+
TABLE
),
(in order to make this fail in the symfony test suite I have to enable the $decorator
parameter in the method getOutputStream()
)
Here's how that table renders:
If I don't use <comment>
as the style, and use the <fg>
type of style, it works as expected:
),
'Header with comment style' => array(
array(
new TableCell('<fg=yellow>Long Title</>', array('colspan' => 3)),
),
array(
array(
new TableCell('9971-5-0210-0', array('colspan' => 3)),
),
new TableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+
| Long Title |
+------------------+---------+------------------+
| 9971-5-0210-0 |
+------------------+---------+------------------+
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+------------------+---------+------------------+
TABLE
),
Output:
The <error>
style also fails:
So does the <question>
style:
But the <info>
style is fine (I assume this is the default for the header rows):
This doesn't happen if there is no colspan:
'Header with comment style' => array(
array(
new TableCell('<comment>Long Title</comment>'),
'Test',
'Test'
),
array(
array(
new TableCell('9971-5-0210-0', array('colspan' => 3)),
),
new TableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+
| Long Title | Test | Test |
+------------------+---------+------------------+
| 9971-5-0210-0 |
+------------------+---------+------------------+
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+------------------+---------+------------------+
TABLE
),
Output:
Position of the Cell with the style doesn't seem to matter, so I think it's just setting a colspan that causes it to color the whole table:
'Header with comment style' => array(
array(
'Test',
'Test',
new TableCell('<comment>Long Title</comment>'),
),
array(
array(
new TableCell('9971-5-0210-0', array('colspan' => 3)),
),
new TableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+---------------------+
| Test | Test | Long Title |
+------------------+---------+---------------------+
| 9971-5-0210-0 |
+------------------+---------+---------------------+
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+------------------+---------+---------------------+
TABLE
),
Output: