Completed
Push — develop ( 98b532...40efcd )
by Adrien
27:48
created

ColumnTest::testInstantiateColumnSpecified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 7
loc 7
rs 9.4285
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
4
5
use PhpOffice\PhpSpreadsheet\Worksheet\Column;
6
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator;
7
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
8
use PHPUnit_Framework_TestCase;
9
10 View Code Duplication
class ColumnTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    public $mockWorksheet;
13
    public $mockColumn;
14
15
    public function setUp()
16
    {
17
        $this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
18
            ->disableOriginalConstructor()
19
            ->getMock();
20
        $this->mockWorksheet->expects($this->any())
21
            ->method('getHighestRow')
22
            ->will($this->returnValue(5));
23
    }
24
25
    public function testInstantiateColumnDefault()
26
    {
27
        $column = new Column($this->mockWorksheet);
28
        self::assertInstanceOf(Column::class, $column);
29
        $columnIndex = $column->getColumnIndex();
30
        self::assertEquals('A', $columnIndex);
31
    }
32
33
    public function testInstantiateColumnSpecified()
34
    {
35
        $column = new Column($this->mockWorksheet, 'E');
36
        self::assertInstanceOf(Column::class, $column);
37
        $columnIndex = $column->getColumnIndex();
38
        self::assertEquals('E', $columnIndex);
39
    }
40
41
    public function testGetCellIterator()
42
    {
43
        $column = new Column($this->mockWorksheet);
44
        $cellIterator = $column->getCellIterator();
45
        self::assertInstanceOf(ColumnCellIterator::class, $cellIterator);
46
    }
47
}
48