1 | <?php |
||
9 | class CalculatorTest extends AbstractUnitTestCase |
||
10 | { |
||
11 | const DATA_DIRECTORY = "/../../data/"; |
||
12 | |||
13 | protected $calculator; |
||
14 | |||
15 | protected function setUp() |
||
19 | |||
20 | public function getDataLocalDate() |
||
46 | |||
47 | public function getDataCorrectTimestamp() |
||
64 | |||
65 | public function getDataTimeZoneName() |
||
80 | |||
81 | public function getNoTimezone() |
||
92 | |||
93 | public function getDataWrongLatitude() |
||
108 | |||
109 | public function getDataWrongLongitude() |
||
125 | |||
126 | public function getDataMaxLatitude() |
||
143 | |||
144 | public function getDataMaxLongitude() |
||
161 | |||
162 | /** |
||
163 | * @dataProvider getDataWrongLatitude |
||
164 | * @param $latitude |
||
165 | * @param $longitude |
||
166 | * @param $expectedException |
||
167 | */ |
||
168 | public function testGetTimeZoneNameWithWrongLatitude($latitude, $longitude, $expectedException) |
||
178 | |||
179 | /** |
||
180 | * @dataProvider getDataWrongLongitude |
||
181 | * @param $latitude |
||
182 | * @param $longitude |
||
183 | * @param $expectedException |
||
184 | */ |
||
185 | public function testGetTimeZoneNameWithWrongLongitude($latitude, $longitude, $expectedException) |
||
195 | |||
196 | /** |
||
197 | * @dataProvider getDataMaxLatitude |
||
198 | * @param $latitude |
||
199 | * @param $longitude |
||
200 | * @param $adjustedLatitude |
||
201 | * @param $expectedException |
||
202 | */ |
||
203 | public function testGetTimeZoneNameWithMaxLatitude($latitude, $longitude, $adjustedLatitude, $expectedException) |
||
213 | |||
214 | /** |
||
215 | * @dataProvider getDataMaxLongitude |
||
216 | * @param $latitude |
||
217 | * @param $longitude |
||
218 | * @param $adjustedLongitude |
||
219 | * @param $expectedException |
||
220 | */ |
||
221 | public function testGetTimeZoneNameWithMaxLongitude($latitude, $longitude, $adjustedLongitude, $expectedException) |
||
231 | |||
232 | /** |
||
233 | * @dataProvider getDataMaxLatitude |
||
234 | * @param $latitude |
||
235 | * @param $longitude |
||
236 | * @param $adjustedLatitude |
||
237 | * @param $expectedException |
||
238 | */ |
||
239 | public function testAdjustLatitudeWithMaxLatitude($latitude, $longitude, $adjustedLatitude, $expectedException) |
||
245 | |||
246 | /** |
||
247 | * @dataProvider getDataMaxLongitude |
||
248 | * @param $latitude |
||
249 | * @param $longitude |
||
250 | * @param $adjustedLongitude |
||
251 | * @param $expectedException |
||
252 | */ |
||
253 | public function testAdjustMaxLongitudeWithMaxLongitude($latitude, $longitude, $adjustedLongitude, |
||
260 | |||
261 | /** |
||
262 | * @dataProvider getDataLocalDate |
||
263 | * @param $latitude |
||
264 | * @param $longitude |
||
265 | * @param $timestamp |
||
266 | * @param $expectedTimeZone |
||
267 | * @param $expectedOffset |
||
268 | */ |
||
269 | public function testGetLocalDate($latitude, $longitude, $timestamp, $expectedTimeZone, $expectedOffset) |
||
282 | |||
283 | /** |
||
284 | * @dataProvider getNoTimezone |
||
285 | * @param $latitude |
||
286 | * @param $longitude |
||
287 | * @param $timestamp |
||
288 | * @param $expectedException |
||
289 | */ |
||
290 | public function testGetLocalDateException($latitude, $longitude, $timestamp, $expectedException) |
||
300 | |||
301 | /** |
||
302 | * @dataProvider getDataCorrectTimestamp |
||
303 | * @param $latitude |
||
304 | * @param $longitude |
||
305 | * @param $timestamp |
||
306 | * @param $expectedTimestamp |
||
307 | */ |
||
308 | public function testGetCorrectTimestamp($latitude, $longitude, $timestamp, $expectedTimestamp) |
||
313 | |||
314 | /** |
||
315 | * @dataProvider getNoTimezone |
||
316 | * @param $latitude |
||
317 | * @param $longitude |
||
318 | * @param $timestamp |
||
319 | * @param $expectedException |
||
320 | */ |
||
321 | public function testGetCorrectTimestampException($latitude, $longitude, $timestamp, $expectedException) |
||
331 | |||
332 | /** |
||
333 | * @dataProvider getDataTimeZoneName |
||
334 | * @param $latitude |
||
335 | * @param $longitude |
||
336 | * @param $expectedTimeZone |
||
337 | */ |
||
338 | public function testGetTimeZoneName($latitude, $longitude, $expectedTimeZone) |
||
347 | |||
348 | /** |
||
349 | * @dataProvider getNoTimezone |
||
350 | * @param $latitude |
||
351 | * @param $longitude |
||
352 | * @param $timestamp |
||
353 | * @param $expectedException |
||
354 | */ |
||
355 | public function testGetTimeZoneNameException($latitude, $longitude, $timestamp, $expectedException) |
||
365 | } |
||
366 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.