Skip to content

Commit

Permalink
sync svn r24497 - Applied patch for ZF-11792
Browse files Browse the repository at this point in the history
  • Loading branch information
sasezaki committed Mar 15, 2012
1 parent ffc97f8 commit 60375c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Zend/Text/Table/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
for ($line = 0; $line < $maxHeight; $line++) {
$result .= $decorator->getVertical();

foreach ($renderedColumns as $renderedColumn) {
foreach ($renderedColumns as $index => $renderedColumn) {
if (isset($renderedColumn[$line]) === true) {
$result .= $renderedColumn[$line];
} else {
$result .= str_repeat(' ', strlen($renderedColumn[0]));
$result .= str_repeat(' ', $this->_columnWidths[$index]);
}

$result .= $decorator->getVertical();
Expand Down
11 changes: 11 additions & 0 deletions tests/Zend/Text/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ public function testRowMultiLine()
$this->assertEquals($row->render(array(10, 10), $decorator), "│foo │foobar │\n│bar │ │\n");
}

public function testUnicodeRowMultiLine()
{
$decorator = new Decorator\Unicode();

$row = new Table\Row();
$row->appendColumn(new Table\Column("föö\nbär"));
$row->appendColumn(new Table\Column("fööbär"));

$this->assertEquals($row->render(array(3, 10), $decorator), "│föö│fööbär │\n│bär│ │\n");
}

public function testTableConstructInvalidColumnWidthsItem()
{
$this->setExpectedException('Zend\Text\Table\Exception\InvalidArgumentException', 'invalid column width');
Expand Down

0 comments on commit 60375c2

Please sign in to comment.