Cell indexes not being respected when rendering row

Fixes #682
When calling `Row::setCellIndex`, it's possible to create a Row with holes.
Instead of iterating over existing cells of a Row, we should instead use the cell indexes (from 0 to max cell index).
This commit is contained in:
Adrien Loison committed 2019-09-28 15:42:19 +02:00
1 parent 2d297e954b
commit ea1dfa22e9
6 files changed
+65 -41

No files matched your search

+14
View File
@@ -78,10 +78,24 @@ class RowTest extends \PHPUnit\Framework\TestCase
$row = new Row([], null);
$cellMock = $this->getCellMock();
$row->setCellAtIndex($cellMock, 3);
$this->assertEquals($cellMock, $row->getCellAtIndex(3));
$this->assertNull($row->getCellAtIndex(10));
}
/**
* @return void
*/
public function testSetCellAtIndex()
{
$row = new Row([], null);
$cellMock = $this->getCellMock();
$row->setCellAtIndex($cellMock, 1);
$this->assertEquals(2, $row->getNumCells());
$this->assertNull($row->getCellAtIndex(0));
}
/**
* @return void
*/