1 | <?php |
||
10 | class PdoReaderTest extends \PHPUnit_Framework_TestCase |
||
11 | { |
||
12 | public function testGetFields() |
||
13 | { |
||
14 | $fields = $this->getReader()->getFields(); |
||
15 | $this->assertInternalType('array', $fields); |
||
16 | $this->assertEquals(array('id', 'username', 'name'), $fields); |
||
17 | } |
||
18 | |||
19 | public function testCount() |
||
23 | |||
24 | public function testIterate() |
||
25 | { |
||
26 | $i=1; |
||
27 | foreach ($this->getReader() as $row) { |
||
28 | $this->assertInternalType('array', $row); |
||
29 | $this->assertEquals('user-'.$i, $row['username']); |
||
30 | $i++; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | public function testReaderRewindWorksCorrectly() |
||
35 | { |
||
36 | $reader = $this->getReader(); |
||
37 | foreach ($reader as $row) { |
||
|
|||
38 | } |
||
39 | |||
40 | foreach ($reader as $row) { |
||
41 | } |
||
42 | } |
||
43 | |||
44 | public function getConnection() |
||
66 | |||
67 | protected function getReader() |
||
68 | { |
||
69 | $connection = $this->getConnection(); |
||
91 | } |
||
92 |
This check looks for
foreach
loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.Consider removing the loop.