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;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2016-03-22 14:35:50 +00:00
|
|
|
class WorksheetRowTest extends \PHPUnit_Framework_TestCase
|
2015-04-26 12:00:58 +00:00
|
|
|
{
|
|
|
|
public $mockWorksheet;
|
|
|
|
public $mockRow;
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
2015-04-26 12:00:58 +00:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2015-04-27 21:47:47 +00:00
|
|
|
$this->mockWorksheet->expects($this->any())
|
|
|
|
->method('getHighestColumn')
|
|
|
|
->will($this->returnValue('E'));
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testInstantiateRowDefault()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet);
|
|
|
|
$this->assertInstanceOf(Row::class, $row);
|
2015-04-26 12:00:58 +00:00
|
|
|
$rowIndex = $row->getRowIndex();
|
|
|
|
$this->assertEquals(1, $rowIndex);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testInstantiateRowSpecified()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet, 5);
|
|
|
|
$this->assertInstanceOf(Row::class, $row);
|
2015-04-26 12:00:58 +00:00
|
|
|
$rowIndex = $row->getRowIndex();
|
|
|
|
$this->assertEquals(5, $rowIndex);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testGetCellIterator()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$row = new Row($this->mockWorksheet);
|
2015-04-26 12:00:58 +00:00
|
|
|
$cellIterator = $row->getCellIterator();
|
2016-08-14 04:08:43 +00:00
|
|
|
$this->assertInstanceOf(RowCellIterator::class, $cellIterator);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|