ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
CellTest.php
Go to the documentation of this file.
1 <?php
2 
3 
4 require_once 'testDataFileIterator.php';
5 
7 {
8 
9  public function setUp()
10  {
11  if (!defined('PHPEXCEL_ROOT')) {
12  define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
13  }
14  require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
15  }
16 
20  public function testColumnIndexFromString()
21  {
22  $args = func_get_args();
23  $expectedResult = array_pop($args);
24  $result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args);
25  $this->assertEquals($expectedResult, $result);
26  }
27 
28  public function providerColumnString()
29  {
30  return new testDataFileIterator('rawTestData/ColumnString.data');
31  }
32 
34  {
35  $cellAddress = 'ABCD';
36  try {
37  $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
38  } catch (PHPExcel_Exception $e) {
39  $this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
40  return;
41  }
42  $this->fail('An expected exception has not been raised.');
43  }
44 
46  {
47  $cellAddress = '';
48  try {
49  $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
50  } catch (PHPExcel_Exception $e) {
51  $this->assertEquals($e->getMessage(), 'Column string index can not be empty');
52  return;
53  }
54  $this->fail('An expected exception has not been raised.');
55  }
56 
60  public function testStringFromColumnIndex()
61  {
62  $args = func_get_args();
63  $expectedResult = array_pop($args);
64  $result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args);
65  $this->assertEquals($expectedResult, $result);
66  }
67 
68  public function providerColumnIndex()
69  {
70  return new testDataFileIterator('rawTestData/ColumnIndex.data');
71  }
72 
76  public function testCoordinateFromString()
77  {
78  $args = func_get_args();
79  $expectedResult = array_pop($args);
80  $result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args);
81  $this->assertEquals($expectedResult, $result);
82  }
83 
84  public function providerCoordinates()
85  {
86  return new testDataFileIterator('rawTestData/CellCoordinates.data');
87  }
88 
90  {
91  $cellAddress = 'A1:AI2012';
92  try {
93  $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
94  } catch (PHPExcel_Exception $e) {
95  $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
96  return;
97  }
98  $this->fail('An expected exception has not been raised.');
99  }
100 
102  {
103  $cellAddress = '';
104  try {
105  $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
106  } catch (PHPExcel_Exception $e) {
107  $this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
108  return;
109  }
110  $this->fail('An expected exception has not been raised.');
111  }
112 
114  {
115  $cellAddress = 'AI';
116  try {
117  $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
118  } catch (PHPExcel_Exception $e) {
119  $this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
120  return;
121  }
122  $this->fail('An expected exception has not been raised.');
123  }
124 
129  {
130  $args = func_get_args();
131  $expectedResult = array_pop($args);
132  $result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args);
133  $this->assertEquals($expectedResult, $result);
134  }
135 
136  public function providerAbsoluteCoordinates()
137  {
138  return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data');
139  }
140 
142  {
143  $cellAddress = 'A1:AI2012';
144  try {
145  $result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress);
146  } catch (PHPExcel_Exception $e) {
147  $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
148  return;
149  }
150  $this->fail('An expected exception has not been raised.');
151  }
152 
157  {
158  $args = func_get_args();
159  $expectedResult = array_pop($args);
160  $result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args);
161  $this->assertEquals($expectedResult, $result);
162  }
163 
164  public function providerAbsoluteReferences()
165  {
166  return new testDataFileIterator('rawTestData/CellAbsoluteReference.data');
167  }
168 
170  {
171  $cellAddress = 'A1:AI2012';
172  try {
173  $result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress);
174  } catch (PHPExcel_Exception $e) {
175  $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
176  return;
177  }
178  $this->fail('An expected exception has not been raised.');
179  }
180 
184  public function testSplitRange()
185  {
186  $args = func_get_args();
187  $expectedResult = array_pop($args);
188  $result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args);
189  foreach($result as $key => $split) {
190  if (!is_array($expectedResult[$key])) {
191  $this->assertEquals($expectedResult[$key], $split[0]);
192  } else {
193  $this->assertEquals($expectedResult[$key], $split);
194  }
195  }
196  }
197 
198  public function providerSplitRange()
199  {
200  return new testDataFileIterator('rawTestData/CellSplitRange.data');
201  }
202 
206  public function testBuildRange()
207  {
208  $args = func_get_args();
209  $expectedResult = array_pop($args);
210  $result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args);
211  $this->assertEquals($expectedResult, $result);
212  }
213 
214  public function providerBuildRange()
215  {
216  return new testDataFileIterator('rawTestData/CellBuildRange.data');
217  }
218 
219  public function testBuildRangeInvalid()
220  {
221  $cellRange = '';
222  try {
223  $result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange);
224  } catch (PHPExcel_Exception $e) {
225  $this->assertEquals($e->getMessage(), 'Range does not contain any information');
226  return;
227  }
228  $this->fail('An expected exception has not been raised.');
229  }
230 
234  public function testRangeBoundaries()
235  {
236  $args = func_get_args();
237  $expectedResult = array_pop($args);
238  $result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args);
239  $this->assertEquals($expectedResult, $result);
240  }
241 
242  public function providerRangeBoundaries()
243  {
244  return new testDataFileIterator('rawTestData/CellRangeBoundaries.data');
245  }
246 
250  public function testRangeDimension()
251  {
252  $args = func_get_args();
253  $expectedResult = array_pop($args);
254  $result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args);
255  $this->assertEquals($expectedResult, $result);
256  }
257 
258  public function providerRangeDimension()
259  {
260  return new testDataFileIterator('rawTestData/CellRangeDimension.data');
261  }
262 
266  public function testGetRangeBoundaries()
267  {
268  $args = func_get_args();
269  $expectedResult = array_pop($args);
270  $result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args);
271  $this->assertEquals($expectedResult, $result);
272  }
273 
274  public function providerGetRangeBoundaries()
275  {
276  return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data');
277  }
278 
283  {
284  $args = func_get_args();
285  $expectedResult = array_pop($args);
286  $result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args);
287  $this->assertEquals($expectedResult, $result);
288  }
289 
291  {
292  return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
293  }
294 
295 }
testRangeDimension()
providerRangeDimension
Definition: CellTest.php:250
providerCoordinates()
Definition: CellTest.php:84
$result
testAbsoluteReferenceFromString()
providerAbsoluteReferences
Definition: CellTest.php:156
testCoordinateFromStringWithEmptyAddress()
Definition: CellTest.php:101
testCoordinateFromStringWithInvalidAddress()
Definition: CellTest.php:113
testCoordinateFromString()
providerCoordinates
Definition: CellTest.php:76
providerAbsoluteReferences()
Definition: CellTest.php:164
testColumnIndexFromString()
providerColumnString
Definition: CellTest.php:20
providerGetRangeBoundaries()
Definition: CellTest.php:274
testStringFromColumnIndex()
providerColumnIndex
Definition: CellTest.php:60
testColumnIndexFromStringTooLong()
Definition: CellTest.php:33
providerSplitRange()
Definition: CellTest.php:198
testColumnIndexFromStringTooShort()
Definition: CellTest.php:45
providerRangeBoundaries()
Definition: CellTest.php:242
providerColumnString()
Definition: CellTest.php:28
testSplitRange()
providerSplitRange
Definition: CellTest.php:184
providerBuildRange()
Definition: CellTest.php:214
testGetRangeBoundaries()
providerGetRangeBoundaries
Definition: CellTest.php:266
testRangeBoundaries()
providerRangeBoundaries
Definition: CellTest.php:234
testAbsoluteCoordinateFromStringWithRangeAddress()
Definition: CellTest.php:141
testExtractAllCellReferencesInRange()
providerExtractAllCellReferencesInRange
Definition: CellTest.php:282
testBuildRangeInvalid()
Definition: CellTest.php:219
Create styles array
The data for the language used.
providerColumnIndex()
Definition: CellTest.php:68
providerRangeDimension()
Definition: CellTest.php:258
testCoordinateFromStringWithRangeAddress()
Definition: CellTest.php:89
testBuildRange()
providerBuildRange
Definition: CellTest.php:206
providerAbsoluteCoordinates()
Definition: CellTest.php:136
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
providerExtractAllCellReferencesInRange()
Definition: CellTest.php:290
setUp()
Definition: CellTest.php:9
testAbsoluteCoordinateFromString()
providerAbsoluteCoordinates
Definition: CellTest.php:128
testAbsoluteReferenceFromStringWithRangeAddress()
Definition: CellTest.php:169