2015-04-26 12:00:58 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
|
2016-03-22 14:35:50 +00:00
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator;
|
2017-10-29 08:39:42 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
2017-11-08 15:48:01 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2017-11-08 15:48:01 +00:00
|
|
|
class RowTest extends TestCase
|
2015-04-26 12:00:58 +00:00
|
|
|
{
|
|
|
|
public $mockWorksheet;
|
2018-01-28 06:59:38 +00:00
|
|
|
|
2015-04-26 12:00:58 +00:00
|
|
|
public $mockRow;
|
|
|
|
|
2020-04-27 10:28:36 +00:00
|
|
|
protected function setUp(): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
2015-04-26 12:00:58 +00:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2020-05-18 04:49:57 +00:00
|
|
|
$this->mockWorksheet->expects(self::any())
|
2017-01-05 03:26:20 +00:00
|
|
|
->method('getHighestColumn')
|
2020-05-18 04:49:57 +00:00
|
|
|
->willReturn('E');
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testInstantiateRowDefault(): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertInstanceOf(Row::class, $row);
|
2015-04-26 12:00:58 +00:00
|
|
|
$rowIndex = $row->getRowIndex();
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals(1, $rowIndex);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testInstantiateRowSpecified(): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet, 5);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertInstanceOf(Row::class, $row);
|
2015-04-26 12:00:58 +00:00
|
|
|
$rowIndex = $row->getRowIndex();
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals(5, $rowIndex);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testGetCellIterator(): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet);
|
2015-04-26 12:00:58 +00:00
|
|
|
$cellIterator = $row->getCellIterator();
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertInstanceOf(RowCellIterator::class, $cellIterator);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|