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

Public Member Functions

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

Data Fields

 $mockWorksheet
 
 $mockColumnCell
 

Detailed Description

Definition at line 3 of file ColumnCellIteratorTest.php.

Member Function Documentation

◆ setUp()

ColumnCellIteratorTest::setUp ( )

Definition at line 8 of file ColumnCellIteratorTest.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->mockCell = $this->getMockBuilder('PHPExcel_Cell')
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('getHighestRow')
25  ->will($this->returnValue(5));
26  $this->mockWorksheet->expects($this->any())
27  ->method('getCellByColumnAndRow')
28  ->will($this->returnValue($this->mockCell));
29  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ testIteratorFullRange()

ColumnCellIteratorTest::testIteratorFullRange ( )

Definition at line 32 of file ColumnCellIteratorTest.php.

References $key.

33  {
34  $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A');
35  $ColumnCellIndexResult = 1;
36  $this->assertEquals($ColumnCellIndexResult, $iterator->key());
37 
38  foreach($iterator as $key => $ColumnCell) {
39  $this->assertEquals($ColumnCellIndexResult++, $key);
40  $this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
41  }
42  }
$key
Definition: croninfo.php:18

◆ testIteratorSeekAndPrev()

ColumnCellIteratorTest::testIteratorSeekAndPrev ( )

Definition at line 56 of file ColumnCellIteratorTest.php.

References $i.

57  {
58  $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
59  $columnIndexResult = 4;
60  $iterator->seek(4);
61  $this->assertEquals($columnIndexResult, $iterator->key());
62 
63  for($i = 1; $i < $columnIndexResult-1; $i++) {
64  $iterator->prev();
65  $this->assertEquals($columnIndexResult - $i, $iterator->key());
66  }
67  }
$i
Definition: disco.tpl.php:19

◆ testIteratorStartEndRange()

ColumnCellIteratorTest::testIteratorStartEndRange ( )

Definition at line 44 of file ColumnCellIteratorTest.php.

References $key.

45  {
46  $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
47  $ColumnCellIndexResult = 2;
48  $this->assertEquals($ColumnCellIndexResult, $iterator->key());
49 
50  foreach($iterator as $key => $ColumnCell) {
51  $this->assertEquals($ColumnCellIndexResult++, $key);
52  $this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
53  }
54  }
$key
Definition: croninfo.php:18

◆ testPrevOutOfRange()

ColumnCellIteratorTest::testPrevOutOfRange ( )

PHPExcel_Exception

Definition at line 81 of file ColumnCellIteratorTest.php.

82  {
83  $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
84  $iterator->prev();
85  }

◆ testSeekOutOfRange()

ColumnCellIteratorTest::testSeekOutOfRange ( )

PHPExcel_Exception

Definition at line 72 of file ColumnCellIteratorTest.php.

73  {
74  $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
75  $iterator->seek(1);
76  }

Field Documentation

◆ $mockColumnCell

ColumnCellIteratorTest::$mockColumnCell

Definition at line 6 of file ColumnCellIteratorTest.php.

◆ $mockWorksheet

ColumnCellIteratorTest::$mockWorksheet

Definition at line 5 of file ColumnCellIteratorTest.php.


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