/** @dataProvider provideNestedTagEdn */ function testParseWithNestedTagHandler($expected, $edn) { $data = igorw\edn\parse($edn, ['myapp/Foo' => function ($node) { return new Foo($node); }]); $this->assertEquals($expected, $data); }
/** * Transforms a string into a array of new EDN data structure(s) * @param string $edn A valid string consisting of EDN * @return array */ protected function _parse($edn) { return \igorw\edn\parse($edn); }
/** * @dataProvider provideInvalidEdnFile * @expectedException igorw\edn\ParserException */ function testParseWithInvalidEdn($ednFile) { $edn = file_get_contents($ednFile); $data = igorw\edn\parse($edn); $this->fail(sprintf('Expected parser to fail on %s, but got: %s', json_encode($edn), print_r($data, true))); }
/** @dataProvider providePerformanceEdnFile */ function testPerformance($ednFile) { $edn = file_get_contents($ednFile); $data = igorw\edn\parse($edn); }
<?php require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/util.php'; $edn = file_get_contents('examples/sample.edn'); $data = igorw\edn\parse($edn); dump($data);