1 | <?php |
||
19 | final class ReaderTest extends TestCase |
||
20 | { |
||
21 | private $unreadableFilePath; |
||
22 | |||
23 | public function setUp() |
||
29 | |||
30 | public function tearDown() |
||
34 | |||
35 | /** |
||
36 | * Verify basic usage of Reader. |
||
37 | * |
||
38 | * @test |
||
39 | * @covers ::next |
||
40 | * @covers ::current |
||
41 | * @covers ::key |
||
42 | * @covers ::valid |
||
43 | * @covers ::rewind |
||
44 | * @dataProvider getReaders() |
||
45 | * |
||
46 | * @param Reader $reader The Reader instance to use in the test. |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function basicUsage(Reader $reader) |
||
86 | |||
87 | /** |
||
88 | * @test |
||
89 | */ |
||
90 | public function readNoHeaders() |
||
127 | |||
128 | /** |
||
129 | * Data provider for basic usage test |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | public function getReaders() |
||
156 | |||
157 | /** |
||
158 | * Verify parameter checks for $file in __construct(). |
||
159 | * |
||
160 | * @param mixed $file The file parameter to check. |
||
161 | * |
||
162 | * @test |
||
163 | * @covers ::__construct |
||
164 | * @expectedException \InvalidArgumentException |
||
165 | * @expectedExceptionMessage $file must be a string containing a full path to a readable delimited file |
||
166 | * @dataProvider getFiles |
||
167 | * |
||
168 | * @return void |
||
169 | */ |
||
170 | public function constructInvalidFileParam($file) |
||
174 | |||
175 | /** |
||
176 | * Data provider for constructInvalidFileParam() test. |
||
177 | * |
||
178 | * @return array |
||
179 | */ |
||
180 | public function getFiles() |
||
189 | |||
190 | /** |
||
191 | * Verify behaviour of consecutive rewind(). |
||
192 | * |
||
193 | * @test |
||
194 | * @covers ::rewind |
||
195 | * |
||
196 | * @return void |
||
197 | */ |
||
198 | public function consecutiveRewind() |
||
210 | |||
211 | /** |
||
212 | * Verify basic behaviour of current(). |
||
213 | * |
||
214 | * @test |
||
215 | * @covers ::current |
||
216 | * |
||
217 | * @return void |
||
218 | */ |
||
219 | public function current() |
||
235 | |||
236 | /** |
||
237 | * Verify behavior of Reader with an empty file |
||
238 | * |
||
239 | * @test |
||
240 | * @covers ::next |
||
241 | * @covers ::current |
||
242 | * @covers ::key |
||
243 | * @covers ::valid |
||
244 | * @covers ::rewind |
||
245 | * @dataProvider getEmptyFiles |
||
246 | * |
||
247 | * @param Reader $reader The reader instance to use in the tests. |
||
248 | * |
||
249 | * @return void |
||
250 | */ |
||
251 | public function emptyFiles(Reader $reader) |
||
263 | |||
264 | /** |
||
265 | * Data provider for empty file test. |
||
266 | * |
||
267 | * @return array |
||
268 | */ |
||
269 | public function getEmptyFiles() |
||
278 | } |
||
279 |
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.