PhpSpreadsheet/tests/PhpSpreadsheetTests/Worksheet/IteratorTest.php

29 lines
830 B
PHP
Raw Permalink Normal View History

<?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
{
$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);
}
}