1 | <?php |
||
12 | class FileTest extends \PHPUnit_Framework_TestCase |
||
13 | { |
||
14 | /** |
||
15 | * Tests File::getPath |
||
16 | */ |
||
17 | public function testGetPath() |
||
22 | |||
23 | /** |
||
24 | * Tests File::read |
||
25 | */ |
||
26 | public function testRead() |
||
33 | |||
34 | /** |
||
35 | * Tests File::read |
||
36 | * |
||
37 | * @expectedException \Exception |
||
38 | */ |
||
39 | public function testReadFail() |
||
46 | |||
47 | /** |
||
48 | * Tests File::write |
||
49 | */ |
||
50 | public function testWrite() |
||
60 | |||
61 | /** |
||
62 | * Tests File::write |
||
63 | * |
||
64 | * @expectedException \Exception |
||
65 | */ |
||
66 | public function testWriteFailNoDir() |
||
74 | |||
75 | /** |
||
76 | * Tests File::write |
||
77 | * |
||
78 | * @expectedException \Exception |
||
79 | */ |
||
80 | public function testNoWritePermission() |
||
88 | |||
89 | /** |
||
90 | * Tests File::write |
||
91 | * |
||
92 | * @expectedException \Exception |
||
93 | */ |
||
94 | public function testCantCreateDirectory() |
||
103 | } |
||
104 |
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.