PhpSpreadsheet/tests/PhpSpreadsheetTests/Worksheet/WorksheetColumnTest.php

47 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
2016-03-22 14:35:50 +00:00
use PhpOffice\PhpSpreadsheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator;
2016-03-22 14:35:50 +00:00
class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
{
public $mockWorksheet;
public $mockColumn;
2015-05-17 13:00:02 +00:00
public function setUp()
{
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet->expects($this->any())
->method('getHighestRow')
->will($this->returnValue(5));
}
2015-05-17 13:00:02 +00:00
public function testInstantiateColumnDefault()
{
$column = new Column($this->mockWorksheet);
$this->assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
$this->assertEquals('A', $columnIndex);
2015-05-17 13:00:02 +00:00
}
2015-05-17 13:00:02 +00:00
public function testInstantiateColumnSpecified()
{
$column = new Column($this->mockWorksheet, 'E');
$this->assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
$this->assertEquals('E', $columnIndex);
2015-05-17 13:00:02 +00:00
}
2015-05-17 13:00:02 +00:00
public function testGetCellIterator()
{
$column = new Column($this->mockWorksheet);
$cellIterator = $column->getCellIterator();
$this->assertInstanceOf(ColumnCellIterator::class, $cellIterator);
2015-05-17 13:00:02 +00:00
}
}