/** * @param resource $stream * @param Definition $definition * @param mixed $origin * @return mixed */ public function decode($stream, Definition $definition, &$origin = null) { $context = new RootContext(new DefinitionContext($origin, $definition)); $handler = new ContextHandler($context); $this->parser->parse($stream, $handler); return $context->fetch(); }
public function testFetch() { $fetched = new \stdClass(); $context = $this->getParserContextMock(); $context->expects($this->once())->method('fetch')->will($this->returnValue($fetched)); $root = new RootContext($context); $this->assertSame($fetched, $root->fetch()); }