1 | <?php |
||
5 | class TrackerTest extends TestCase |
||
6 | { |
||
7 | protected $tracker = null; |
||
8 | |||
9 | public function setup() |
||
13 | |||
14 | /** |
||
15 | * @expectedException InvalidArgumentException |
||
16 | * @expectedExceptionMessageRegExp /is not a valid tracking number/ |
||
17 | */ |
||
18 | public function testTrackingNumberIsInvalid1() |
||
22 | |||
23 | /** |
||
24 | * @expectedException InvalidArgumentException |
||
25 | * @expectedExceptionMessageRegExp /is not a valid tracking number/ |
||
26 | */ |
||
27 | public function testTrackingNumberIsInvalid2() |
||
31 | |||
32 | /** |
||
33 | * @expectedException InvalidArgumentException |
||
34 | * @expectedExceptionMessageRegExp /is not a valid tracking number/ |
||
35 | */ |
||
36 | public function testTrackingNumberIsInvalid3() |
||
40 | |||
41 | /** |
||
42 | * @expectedException InvalidArgumentException |
||
43 | * @expectedExceptionMessageRegExp /is not a valid tracking number/ |
||
44 | */ |
||
45 | public function testTrackingNumberIsInvalid4() |
||
49 | |||
50 | /** |
||
51 | * @expectedException InvalidArgumentException |
||
52 | * @expectedExceptionMessageRegExp /is not a valid tracking number/ |
||
53 | */ |
||
54 | public function testTrackingNumberIsInvalid5() |
||
58 | |||
59 | /** |
||
60 | * Bad test, API call should be mocked |
||
61 | * @TODO: mock api call |
||
62 | * @expectedException RuntimeException |
||
63 | */ |
||
64 | public function testTrackingNumberIsValidButCredentialsAreNot() |
||
68 | |||
69 | /** |
||
70 | * @TODO: mock api call |
||
71 | */ |
||
72 | public function testApiResponseProcessingIsSuccessful() |
||
77 | |||
78 | /** |
||
79 | * @TODO: mock api call |
||
80 | * @expectedException RuntimeException |
||
81 | * @expectedExceptionMessageRegExp /API call error/ |
||
82 | */ |
||
83 | public function testApiResponseProcessingIsUnsuccessful() |
||
93 | } |
||
94 |
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.