1 | <?php |
||
13 | class CollectionTest extends TestCase |
||
14 | { |
||
15 | |||
16 | protected $collection; |
||
17 | |||
18 | |||
19 | public function setUp() |
||
26 | |||
27 | |||
28 | public function testInstantiation() |
||
32 | |||
33 | |||
34 | public function testOffsetExists() |
||
40 | |||
41 | |||
42 | /** |
||
43 | * @expectedException OutOfRangeException |
||
44 | * @expectedExceptionMessage Invalid collection index: 2 |
||
45 | */ |
||
46 | public function testOffsetGet() |
||
52 | |||
53 | |||
54 | /** |
||
55 | * @expectedException Exception |
||
56 | * @expectedExceptionMessage Search result collection is immutable. |
||
57 | */ |
||
58 | public function testOffsetSetImmutability() |
||
62 | |||
63 | |||
64 | /** |
||
65 | * @expectedException Exception |
||
66 | * @expectedExceptionMessage Search result collection is immutable. |
||
67 | */ |
||
68 | public function testOffsetUnsetImmutability() |
||
72 | |||
73 | |||
74 | public function testIterator() |
||
79 | |||
80 | |||
81 | public function testCountable() |
||
86 | |||
87 | |||
88 | public function testTotalCount() |
||
92 | |||
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.