public function testParseSimpleDocumentFromUri() { $handler = $this->getParserHandlerMock(); $handler->expects($this->once())->method('start')->with('root', array()); $handler->expects($this->once())->method('append')->with('content'); $handler->expects($this->once())->method('end')->with('root'); $stream = new Stream("<root>content</root>"); $parser = new XmlParser(); $parser->parse($stream->getUri(), $handler); }
public function stat() { if ($this->content === false) { return false; } return parent::stat(); }
public function testWriteToUri() { $origin = new \stdClass(); $definition = $this->getDefinitionMock(); $definition->expects($this->once())->method('isScalar')->will($this->returnValue(true)); $definition->expects($this->once())->method('getNodeName')->will($this->returnValue('scalar')); $definition->expects($this->once())->method('extract')->with($origin)->will($this->returnValue('foo')); $stream = new Stream(); $writer = new XmlWriter(); $writer->write($stream->getUri(), $origin, $definition); $this->assertXmlStringEqualsXmlString("<scalar>foo</scalar>", $stream->getContent()); }
/** * @param $start * @param $offset * @param $whence * @param $size * @param $tell * * @dataProvider provideSeekAndTell */ public function testSeekAndTell($start, $offset, $whence, $size, $tell) { $stream = new Stream(str_repeat('X', $size)); $stream->seek($start, SEEK_SET); $stream->seek($offset, $whence); $this->assertEquals($tell, $stream->tell()); }