PhpSpreadsheet/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php

49 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\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class ColumnTest extends TestCase
{
public $mockWorksheet;
2018-01-28 06:59:38 +00:00
public $mockColumn;
2020-04-27 10:28:36 +00:00
protected function setUp(): void
2015-05-17 13:00:02 +00:00
{
$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);
self::assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
self::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');
self::assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
self::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();
self::assertInstanceOf(ColumnCellIterator::class, $cellIterator);
2015-05-17 13:00:02 +00:00
}
}