@@ 27-40 (lines=14) @@ | ||
24 | return require 'data/ColumnString.php'; |
|
25 | } |
|
26 | ||
27 | public function testColumnIndexFromStringTooLong() |
|
28 | { |
|
29 | $cellAddress = 'ABCD'; |
|
30 | ||
31 | try { |
|
32 | Cell::columnIndexFromString($cellAddress); |
|
33 | } catch (\Exception $e) { |
|
34 | self::assertInstanceOf(Exception::class, $e); |
|
35 | self::assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters'); |
|
36 | ||
37 | return; |
|
38 | } |
|
39 | $this->fail('An expected exception has not been raised.'); |
|
40 | } |
|
41 | ||
42 | public function testColumnIndexFromStringTooShort() |
|
43 | { |
|
@@ 42-55 (lines=14) @@ | ||
39 | $this->fail('An expected exception has not been raised.'); |
|
40 | } |
|
41 | ||
42 | public function testColumnIndexFromStringTooShort() |
|
43 | { |
|
44 | $cellAddress = ''; |
|
45 | ||
46 | try { |
|
47 | Cell::columnIndexFromString($cellAddress); |
|
48 | } catch (\Exception $e) { |
|
49 | self::assertInstanceOf(Exception::class, $e); |
|
50 | self::assertEquals($e->getMessage(), 'Column string index can not be empty'); |
|
51 | ||
52 | return; |
|
53 | } |
|
54 | $this->fail('An expected exception has not been raised.'); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @dataProvider providerColumnIndex |
|
@@ 89-102 (lines=14) @@ | ||
86 | return require 'data/CellCoordinates.php'; |
|
87 | } |
|
88 | ||
89 | public function testCoordinateFromStringWithRangeAddress() |
|
90 | { |
|
91 | $cellAddress = 'A1:AI2012'; |
|
92 | ||
93 | try { |
|
94 | Cell::coordinateFromString($cellAddress); |
|
95 | } catch (\Exception $e) { |
|
96 | self::assertInstanceOf(Exception::class, $e); |
|
97 | self::assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); |
|
98 | ||
99 | return; |
|
100 | } |
|
101 | $this->fail('An expected exception has not been raised.'); |
|
102 | } |
|
103 | ||
104 | public function testCoordinateFromStringWithEmptyAddress() |
|
105 | { |
|
@@ 104-117 (lines=14) @@ | ||
101 | $this->fail('An expected exception has not been raised.'); |
|
102 | } |
|
103 | ||
104 | public function testCoordinateFromStringWithEmptyAddress() |
|
105 | { |
|
106 | $cellAddress = ''; |
|
107 | ||
108 | try { |
|
109 | Cell::coordinateFromString($cellAddress); |
|
110 | } catch (\Exception $e) { |
|
111 | self::assertInstanceOf(Exception::class, $e); |
|
112 | self::assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string'); |
|
113 | ||
114 | return; |
|
115 | } |
|
116 | $this->fail('An expected exception has not been raised.'); |
|
117 | } |
|
118 | ||
119 | public function testCoordinateFromStringWithInvalidAddress() |
|
120 | { |
|
@@ 119-132 (lines=14) @@ | ||
116 | $this->fail('An expected exception has not been raised.'); |
|
117 | } |
|
118 | ||
119 | public function testCoordinateFromStringWithInvalidAddress() |
|
120 | { |
|
121 | $cellAddress = 'AI'; |
|
122 | ||
123 | try { |
|
124 | Cell::coordinateFromString($cellAddress); |
|
125 | } catch (\Exception $e) { |
|
126 | self::assertInstanceOf(Exception::class, $e); |
|
127 | self::assertEquals($e->getMessage(), 'Invalid cell coordinate ' . $cellAddress); |
|
128 | ||
129 | return; |
|
130 | } |
|
131 | $this->fail('An expected exception has not been raised.'); |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * @dataProvider providerAbsoluteCoordinates |
|
@@ 150-163 (lines=14) @@ | ||
147 | return require 'data/CellAbsoluteCoordinate.php'; |
|
148 | } |
|
149 | ||
150 | public function testAbsoluteCoordinateFromStringWithRangeAddress() |
|
151 | { |
|
152 | $cellAddress = 'A1:AI2012'; |
|
153 | ||
154 | try { |
|
155 | Cell::absoluteCoordinate($cellAddress); |
|
156 | } catch (\Exception $e) { |
|
157 | self::assertInstanceOf(Exception::class, $e); |
|
158 | self::assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); |
|
159 | ||
160 | return; |
|
161 | } |
|
162 | $this->fail('An expected exception has not been raised.'); |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * @dataProvider providerAbsoluteReferences |
|
@@ 181-194 (lines=14) @@ | ||
178 | return require 'data/CellAbsoluteReference.php'; |
|
179 | } |
|
180 | ||
181 | public function testAbsoluteReferenceFromStringWithRangeAddress() |
|
182 | { |
|
183 | $cellAddress = 'A1:AI2012'; |
|
184 | ||
185 | try { |
|
186 | Cell::absoluteReference($cellAddress); |
|
187 | } catch (\Exception $e) { |
|
188 | self::assertInstanceOf(Exception::class, $e); |
|
189 | self::assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); |
|
190 | ||
191 | return; |
|
192 | } |
|
193 | $this->fail('An expected exception has not been raised.'); |
|
194 | } |
|
195 | ||
196 | /** |
|
197 | * @dataProvider providerSplitRange |