| @@ 34-42 (lines=9) @@ | ||
| 31 | * @param string $json |
|
| 32 | * @param array $expected |
|
| 33 | */ |
|
| 34 | public function testParse(JsonFormatInterface $format, $json, array $expected) |
|
| 35 | { |
|
| 36 | $parser = new JsonParser($format); |
|
| 37 | ||
| 38 | $iterator = $parser->parse($this->createStream($json)); |
|
| 39 | $actual = iterator_to_array($iterator); |
|
| 40 | ||
| 41 | static::assertEquals($expected, $actual); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @return array |
|
| @@ 233-244 (lines=12) @@ | ||
| 230 | * @param string $exception |
|
| 231 | * @param string|null $regex |
|
| 232 | */ |
|
| 233 | public function testParseFailures(JsonFormatInterface $format, $json, $exception, $regex = null) |
|
| 234 | { |
|
| 235 | $parser = new JsonParser($format); |
|
| 236 | ||
| 237 | static::expectException($exception); |
|
| 238 | if ($regex) { |
|
| 239 | static::expectExceptionMessageRegExp($regex); |
|
| 240 | } |
|
| 241 | $iterator = $parser->parse($this->createStream($json)); |
|
| 242 | ||
| 243 | iterator_to_array($iterator); |
|
| 244 | } |
|
| 245 | ||
| 246 | /** |
|
| 247 | * @return array |
|