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

Public Member Functions

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

Data Fields

 $mockWorksheet
 
 $mockRowCell
 

Detailed Description

Definition at line 3 of file RowCellIteratorTest.php.

Member Function Documentation

◆ setUp()

RowCellIteratorTest::setUp ( )

Definition at line 8 of file RowCellIteratorTest.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('getHighestColumn')
25  ->will($this->returnValue('E'));
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()

RowCellIteratorTest::testIteratorFullRange ( )

Definition at line 32 of file RowCellIteratorTest.php.

References $key.

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

◆ testIteratorSeekAndPrev()

RowCellIteratorTest::testIteratorSeekAndPrev ( )

Definition at line 56 of file RowCellIteratorTest.php.

References $i, and range.

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

◆ testIteratorStartEndRange()

RowCellIteratorTest::testIteratorStartEndRange ( )

Definition at line 44 of file RowCellIteratorTest.php.

References $key.

45  {
46  $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
47  $RowCellIndexResult = 'B';
48  $this->assertEquals($RowCellIndexResult, $iterator->key());
49 
50  foreach($iterator as $key => $RowCell) {
51  $this->assertEquals($RowCellIndexResult++, $key);
52  $this->assertInstanceOf('PHPExcel_Cell', $RowCell);
53  }
54  }
$key
Definition: croninfo.php:18

◆ testPrevOutOfRange()

RowCellIteratorTest::testPrevOutOfRange ( )

PHPExcel_Exception

Definition at line 83 of file RowCellIteratorTest.php.

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

◆ testSeekOutOfRange()

RowCellIteratorTest::testSeekOutOfRange ( )

PHPExcel_Exception

Definition at line 74 of file RowCellIteratorTest.php.

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

Field Documentation

◆ $mockRowCell

RowCellIteratorTest::$mockRowCell

Definition at line 6 of file RowCellIteratorTest.php.

◆ $mockWorksheet

RowCellIteratorTest::$mockWorksheet

Definition at line 5 of file RowCellIteratorTest.php.


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