@@ 34-43 (lines=10) @@ | ||
31 | * @param string $line |
|
32 | * @param array $expected |
|
33 | */ |
|
34 | public function testParse(CsvFormatInterface $format, $line, array $expected) |
|
35 | { |
|
36 | $parser = new CsvParser($format); |
|
37 | ||
38 | $iterator = $parser->parse($this->createStream($line)); |
|
39 | $actual = iterator_to_array($iterator); |
|
40 | $actual = array_values(array_map('iterator_to_array', $actual)); |
|
41 | ||
42 | static::assertEquals($expected, $actual); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @param string $string |
|
@@ 160-171 (lines=12) @@ | ||
157 | * @param string $line |
|
158 | * @param string $expected |
|
159 | */ |
|
160 | public function testParseFailure(CsvFormatInterface $format, $line, $expected) |
|
161 | { |
|
162 | $parser = new CsvParser($format); |
|
163 | ||
164 | $iterator = $parser->parse($this->createStream($line)); |
|
165 | ||
166 | static::expectException($expected); |
|
167 | $actual = iterator_to_array($iterator); |
|
168 | $actual = array_values(array_map('iterator_to_array', $actual)); |
|
169 | ||
170 | static::assertEquals($expected, $actual); |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * @return array |