@@ 137-162 (lines=26) @@ | ||
134 | * Test if various range types are properly handled |
|
135 | * @dataProvider rangeValueTypesProvider |
|
136 | */ |
|
137 | public function testRangeValues($testRange, $rangeKey) |
|
138 | { |
|
139 | $expectedArrayKeys = [ |
|
140 | "{$rangeKey}Min", |
|
141 | "{$rangeKey}Max" |
|
142 | ]; |
|
143 | ||
144 | $field = new Field(2, $testRange); |
|
145 | $this->assertArrayHasKey( |
|
146 | $rangeKey, |
|
147 | $field->toArray(), |
|
148 | 'key doesn\'t exist in array representation' |
|
149 | ); |
|
150 | ||
151 | $this->assertSame( |
|
152 | $field->toArray()[$rangeKey], |
|
153 | array_combine($expectedArrayKeys, $testRange), |
|
154 | 'array representation contains wrong value' |
|
155 | ); |
|
156 | ||
157 | $this->assertSame( |
|
158 | $field->getValue(), |
|
159 | $testRange, |
|
160 | 'getValue() returns wrong value' |
|
161 | ); |
|
162 | } |
|
163 | ||
164 | ||
165 | /** |
|
@@ 169-196 (lines=28) @@ | ||
166 | * Test if range types are properly handled when reversed |
|
167 | * @dataProvider rangeValueTypesProvider |
|
168 | */ |
|
169 | public function testRangeValuesReversed($testRange, $rangeKey) |
|
170 | { |
|
171 | $expectedArrayKeys = [ |
|
172 | "{$rangeKey}Min", |
|
173 | "{$rangeKey}Max" |
|
174 | ]; |
|
175 | ||
176 | $reverseRange = array_reverse($testRange); |
|
177 | ||
178 | $field = new Field(2, $reverseRange); |
|
179 | $this->assertArrayHasKey( |
|
180 | $rangeKey, |
|
181 | $field->toArray(), |
|
182 | 'key doesn\'t exist in array representation' |
|
183 | ); |
|
184 | ||
185 | $this->assertSame( |
|
186 | $field->toArray()[$rangeKey], |
|
187 | array_combine($expectedArrayKeys, $testRange), |
|
188 | 'array representation contains wrong value' |
|
189 | ); |
|
190 | ||
191 | $this->assertSame( |
|
192 | $field->getValue(), |
|
193 | $testRange, |
|
194 | 'getValue() returns wrong value' |
|
195 | ); |
|
196 | } |
|
197 | ||
198 | ||
199 | /** |