| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | function testCsvReading() { |
||
|
|
|||
| 8 | |||
| 9 | $csv = new CsvTableReader(__DIR__ . '/fixture/input.csv'); |
||
| 10 | $this->assertEquals(['Col1', 'Col2', 'Col3'], $csv->getColumns()); |
||
| 11 | |||
| 12 | $extractedData = []; |
||
| 13 | foreach($csv as $record) { |
||
| 14 | $extractedData[] = $record; |
||
| 15 | } |
||
| 16 | |||
| 17 | $this->assertEquals( |
||
| 18 | [ |
||
| 19 | [ 'Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three' ], |
||
| 20 | [ 'Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?" ] |
||
| 21 | ], |
||
| 22 | $extractedData |
||
| 23 | ); |
||
| 24 | |||
| 25 | } |
||
| 26 | } |
||
| 27 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.