Skip to content

Commit d7d1b29

Browse files
Merge branch '3.4' into 4.1
* 3.4: [Debug] Fix false-positive "MicroKernelTrait::loadRoutes()" method is considered internal" [Console] Fixed boxed table style with colspan parse numbers terminated with decimal separator fail reverse transforming invalid RFC 3339 dates
2 parents 45e683e + d2c9c9b commit d7d1b29

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

Helper/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,13 @@ private function calculateColumnsWidth(iterable $rows)
656656
$lengths[] = $this->getCellWidth($row, $column);
657657
}
658658

659-
$this->effectiveColumnWidths[$column] = max($lengths) + \strlen($this->style->getCellRowContentFormat()) - 2;
659+
$this->effectiveColumnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
660660
}
661661
}
662662

663663
private function getColumnSeparatorWidth(): int
664664
{
665-
return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
665+
return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
666666
}
667667

668668
private function getCellWidth(array $row, int $column): int

Tests/Helper/TableTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,42 @@ public function testGetStyleDefinition()
974974
Table::getStyleDefinition('absent');
975975
}
976976

977+
public function testBoxedStyleWithColspan()
978+
{
979+
$boxed = new TableStyle();
980+
$boxed
981+
->setHorizontalBorderChars('')
982+
->setVerticalBorderChars('')
983+
->setCrossingChars('', '', '', '', '', '', '', '', '')
984+
;
985+
986+
$table = new Table($output = $this->getOutputStream());
987+
$table->setStyle($boxed);
988+
$table
989+
->setHeaders(array('ISBN', 'Title', 'Author'))
990+
->setRows(array(
991+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
992+
new TableSeparator(),
993+
array(new TableCell('This value spans 3 columns.', array('colspan' => 3))),
994+
))
995+
;
996+
$table->render();
997+
998+
$expected =
999+
<<<TABLE
1000+
┌───────────────┬───────────────┬─────────────────┐
1001+
│ ISBN │ Title │ Author │
1002+
├───────────────┼───────────────┼─────────────────┤
1003+
│ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri │
1004+
├───────────────┼───────────────┼─────────────────┤
1005+
│ This value spans 3 columns. │
1006+
└───────────────┴───────────────┴─────────────────┘
1007+
1008+
TABLE;
1009+
1010+
$this->assertSame($expected, $this->getOutputContent($output));
1011+
}
1012+
9771013
protected function getOutputStream($decorated = false)
9781014
{
9791015
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated);

0 commit comments

Comments
 (0)