ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ColumnIteratorTest Class Reference
+ Inheritance diagram for ColumnIteratorTest:
+ Collaboration diagram for ColumnIteratorTest:

Public Member Functions

 setUp ()
 
 testIteratorFullRange ()
 
 testIteratorStartEndRange ()
 
 testIteratorSeekAndPrev ()
 
 testSeekOutOfRange ()
 PHPExcel_Exception More...
 
 testPrevOutOfRange ()
 PHPExcel_Exception More...
 

Data Fields

 $mockWorksheet
 
 $mockColumn
 

Detailed Description

Definition at line 3 of file ColumnIteratorTest.php.

Member Function Documentation

◆ setUp()

ColumnIteratorTest::setUp ( )

Definition at line 8 of file ColumnIteratorTest.php.

References defined.

9  {
10  if (!defined('PHPEXCEL_ROOT')) {
11  define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
12  }
13  require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
14 
15  $this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column')
16  ->disableOriginalConstructor()
17  ->getMock();
18 
19  $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $this->mockWorksheet->expects($this->any())
24  ->method('getHighestColumn')
25  ->will($this->returnValue('E'));
26  $this->mockWorksheet->expects($this->any())
27  ->method('current')
28  ->will($this->returnValue($this->mockColumn));
29  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ testIteratorFullRange()

ColumnIteratorTest::testIteratorFullRange ( )

Definition at line 32 of file ColumnIteratorTest.php.

References $column, and $key.

33  {
34  $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet);
35  $columnIndexResult = 'A';
36  $this->assertEquals($columnIndexResult, $iterator->key());
37 
38  foreach($iterator as $key => $column) {
39  $this->assertEquals($columnIndexResult++, $key);
40  $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
41  }
42  }
$column
Definition: 39dropdown.php:62
$key
Definition: croninfo.php:18

◆ testIteratorSeekAndPrev()

ColumnIteratorTest::testIteratorSeekAndPrev ( )

Definition at line 56 of file ColumnIteratorTest.php.

References $i, and range.

57  {
58  $ranges = range('A','E');
59  $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
60  $columnIndexResult = 'D';
61  $iterator->seek('D');
62  $this->assertEquals($columnIndexResult, $iterator->key());
63 
64  for($i = 1; $i < array_search($columnIndexResult, $ranges); $i++) {
65  $iterator->prev();
66  $expectedResult = $ranges[array_search($columnIndexResult, $ranges) - $i];
67  $this->assertEquals($expectedResult, $iterator->key());
68  }
69  }
Resolve range
$i
Definition: disco.tpl.php:19

◆ testIteratorStartEndRange()

ColumnIteratorTest::testIteratorStartEndRange ( )

Definition at line 44 of file ColumnIteratorTest.php.

References $column, and $key.

45  {
46  $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
47  $columnIndexResult = 'B';
48  $this->assertEquals($columnIndexResult, $iterator->key());
49 
50  foreach($iterator as $key => $column) {
51  $this->assertEquals($columnIndexResult++, $key);
52  $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
53  }
54  }
$column
Definition: 39dropdown.php:62
$key
Definition: croninfo.php:18

◆ testPrevOutOfRange()

ColumnIteratorTest::testPrevOutOfRange ( )

PHPExcel_Exception

Definition at line 83 of file ColumnIteratorTest.php.

84  {
85  $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
86  $iterator->prev();
87  }

◆ testSeekOutOfRange()

ColumnIteratorTest::testSeekOutOfRange ( )

PHPExcel_Exception

Definition at line 74 of file ColumnIteratorTest.php.

75  {
76  $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
77  $iterator->seek('A');
78  }

Field Documentation

◆ $mockColumn

ColumnIteratorTest::$mockColumn

Definition at line 6 of file ColumnIteratorTest.php.

◆ $mockWorksheet

ColumnIteratorTest::$mockWorksheet

Definition at line 5 of file ColumnIteratorTest.php.


The documentation for this class was generated from the following file: