|
@@ 35-44 (lines=10) @@
|
| 32 |
|
* @param string $line |
| 33 |
|
* @param array $expected |
| 34 |
|
*/ |
| 35 |
|
public function testParse(CsvFormatInterface $format, $line, array $expected) |
| 36 |
|
{ |
| 37 |
|
$parser = new CsvParser($format); |
| 38 |
|
|
| 39 |
|
$iterator = $parser->parse($this->createStream($line)); |
| 40 |
|
$actual = iterator_to_array($iterator); |
| 41 |
|
$actual = array_values(array_map('iterator_to_array', $actual)); |
| 42 |
|
|
| 43 |
|
static::assertEquals($expected, $actual); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
/** |
| 47 |
|
* @return array |
|
@@ 148-159 (lines=12) @@
|
| 145 |
|
* @param string $line |
| 146 |
|
* @param string $expected |
| 147 |
|
*/ |
| 148 |
|
public function testParseFailure(CsvFormatInterface $format, $line, $expected) |
| 149 |
|
{ |
| 150 |
|
$parser = new CsvParser($format); |
| 151 |
|
|
| 152 |
|
$iterator = $parser->parse($this->createStream($line)); |
| 153 |
|
|
| 154 |
|
static::expectException($expected); |
| 155 |
|
$actual = iterator_to_array($iterator); |
| 156 |
|
$actual = array_values(array_map('iterator_to_array', $actual)); |
| 157 |
|
|
| 158 |
|
static::assertEquals($expected, $actual); |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
/** |
| 162 |
|
* @return array |