spout/tests/Spout/Writer/Common/Helper/CellHelperTest.php
Adrien Loison ea1dfa22e9 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).
2019-09-28 15:42:19 +02:00

39 lines
841 B
PHP

<?php
namespace Box\Spout\Writer\Common\Helper;
use PHPUnit\Framework\TestCase;
/**
* Class CellHelperTest
*/
class CellHelperTest extends TestCase
{
/**
* @return array
*/
public function dataProviderForTestGetColumnLettersFromColumnIndex()
{
return [
[0, 'A'],
[1, 'B'],
[25, 'Z'],
[26, 'AA'],
[28, 'AC'],
];
}
/**
* @dataProvider dataProviderForTestGetColumnLettersFromColumnIndex
*
* @param int $columnIndex
* @param string $expectedColumnLetters
*
* @return void
*/
public function testGetColumnLettersFromColumnIndex($columnIndex, $expectedColumnLetters)
{
$this->assertEquals($expectedColumnLetters, CellHelper::getColumnLettersFromColumnIndex($columnIndex));
}
}