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\Column;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2016-03-22 14:35:50 +00:00
|
|
|
class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
|
2015-04-26 12:00:58 +00:00
|
|
|
{
|
|
|
|
public $mockWorksheet;
|
|
|
|
public $mockColumn;
|
|
|
|
|
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())
|
2017-01-05 03:26:20 +00:00
|
|
|
->method('getHighestRow')
|
|
|
|
->will($this->returnValue(5));
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testInstantiateColumnDefault()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$column = new Column($this->mockWorksheet);
|
|
|
|
$this->assertInstanceOf(Column::class, $column);
|
2015-04-26 12:00:58 +00:00
|
|
|
$columnIndex = $column->getColumnIndex();
|
|
|
|
$this->assertEquals('A', $columnIndex);
|
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 testInstantiateColumnSpecified()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
$column = new Column($this->mockWorksheet, 'E');
|
|
|
|
$this->assertInstanceOf(Column::class, $column);
|
2015-04-26 12:00:58 +00:00
|
|
|
$columnIndex = $column->getColumnIndex();
|
|
|
|
$this->assertEquals('E', $columnIndex);
|
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
|
|
|
$column = new Column($this->mockWorksheet);
|
2015-04-26 12:00:58 +00:00
|
|
|
$cellIterator = $column->getCellIterator();
|
2016-08-14 04:08:43 +00:00
|
|
|
$this->assertInstanceOf(ColumnCellIterator::class, $cellIterator);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2015-04-26 12:00:58 +00:00
|
|
|
}
|