public function marshalToStream($mappedObject, $streamUri)
{
$writer = new WriterHelper($this, $streamUri);
// clear the internal visited list
$this->visited = array();
// Begin marshalling
$this->doMarshal($mappedObject, $writer);
return $writer->flush();
}
/** * @test */ public function itShouldMarshalToFilenameStream() { $simple = new SimpleWithField(); $xml = $this->marshaller->marshalToStream($simple, "file://" . realpath(__DIR__) . "/../Workspace/Foo.xml"); $this->assertTrue(strlen($xml) > 0); $this->assertXmlStringEqualsXmlFile(realpath(__DIR__) . "/../Workspace/Foo.xml", '<?xml version="1.0" encoding="UTF-8"?><simple-with-field/>'); @unlink(realpath(__DIR__) . "/../Workspace/Foo.xml"); }