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).
39 lines
841 B
PHP
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));
|
|
}
|
|
}
|