2018-08-07 07:38:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
|
|
|
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Iterator;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class IteratorTest extends TestCase
|
|
|
|
{
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testIteratorFullRange(): void
|
2018-08-07 07:38:18 +00:00
|
|
|
{
|
|
|
|
$spreadsheet = new Spreadsheet();
|
|
|
|
$spreadsheet->createSheet();
|
|
|
|
$spreadsheet->createSheet();
|
|
|
|
|
|
|
|
$iterator = new Iterator($spreadsheet);
|
|
|
|
$columnIndexResult = 0;
|
|
|
|
self::assertEquals($columnIndexResult, $iterator->key());
|
|
|
|
|
|
|
|
foreach ($iterator as $key => $column) {
|
|
|
|
self::assertEquals($columnIndexResult++, $key);
|
|
|
|
self::assertInstanceOf(Worksheet::class, $column);
|
|
|
|
}
|
|
|
|
self::assertSame(3, $columnIndexResult);
|
|
|
|
}
|
|
|
|
}
|