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

Public Member Functions

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

Data Fields

 $mockWorksheet
 
 $mockRow
 

Detailed Description

Definition at line 3 of file RowIteratorTest.php.

Member Function Documentation

◆ setUp()

RowIteratorTest::setUp ( )

Definition at line 8 of file RowIteratorTest.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->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row')
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('current')
28  ->will($this->returnValue($this->mockRow));
29  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ testIteratorFullRange()

RowIteratorTest::testIteratorFullRange ( )

Definition at line 32 of file RowIteratorTest.php.

References $key, and $row.

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

◆ testIteratorSeekAndPrev()

RowIteratorTest::testIteratorSeekAndPrev ( )

Definition at line 56 of file RowIteratorTest.php.

References $i.

57  {
58  $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 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()

RowIteratorTest::testIteratorStartEndRange ( )

Definition at line 44 of file RowIteratorTest.php.

References $key, and $row.

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

◆ testPrevOutOfRange()

RowIteratorTest::testPrevOutOfRange ( )

PHPExcel_Exception

Definition at line 81 of file RowIteratorTest.php.

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

◆ testSeekOutOfRange()

RowIteratorTest::testSeekOutOfRange ( )

PHPExcel_Exception

Definition at line 72 of file RowIteratorTest.php.

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

Field Documentation

◆ $mockRow

RowIteratorTest::$mockRow

Definition at line 6 of file RowIteratorTest.php.

◆ $mockWorksheet

RowIteratorTest::$mockWorksheet

Definition at line 5 of file RowIteratorTest.php.


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