* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class XmlTest extends TestCase { public function testWriteTo() { $response = new Response(200); $body = new Xml($this->getXml()); $body->writeTo($response); $this->assertEquals(['content-type' => ['application/xml']], $response->getHeaders()); $this->assertXmlStringEqualsXmlString($this->getXml(), $response->getBody()->__toString()); } public function testWriteToDomDocument() { $dom = new \DOMDocument(); $dom->loadXML($this->getXml()); $response = new Response(200); $body = new Xml($dom); $body->writeTo($response); $this->assertEquals(['content-type' => ['application/xml']], $response->getHeaders()); $this->assertXmlStringEqualsXmlString($this->getXml(), $response->getBody()->__toString()); } public function testWriteToSimpleXMLElement() { $response = new Response(200); $body = new Xml(new \SimpleXMLElement($this->getXml())); $body->writeTo($response); $this->assertEquals(['content-type' => ['application/xml']], $response->getHeaders()); $this->assertXmlStringEqualsXmlString($this->getXml(), $response->getBody()->__toString()); } private function getXml() { return "\n\n foo\n"; } } __halt_compiler();----SIGNATURE:----e5TdlSe2sL4+qc9K/NI5h+Ercxgu6v6kmhQ9UCg9uKj6/ZdBqMqrEK6zPfV4/GVvTsYPm9Q1FWGEq6DWjruadQV1Rw4uDBqwUyIiHL7YrnWJDT+gJk6GXquzWs9BONVKOeMQJFRdDYmBAc098H7MWluQT427kkV+C4Q1w0wEACsdfSeN1QJnhjJcjWfxKsl/NypEH32PRvQZsCPTOTffIfRCrzVYOivFqS0W1uO9Ri4NQZv37uAnPrhQVZZ5w8OK6dC1k7AUty+fXaX9070yuCvwSJiljgAGpzIH1Q0uK+PDI9XZBrAPnqvL76sugjNtdv32Hu+GOKBcm10EXTYFRtgZopoy/gMdvL+YM+eheLbdykhCoIBKKGSUrfWyF6MJ/EFW/yXOhtWVE7+okqbhuu9bruIhzbJRvnTm6GCxP+aqOZ12n+9qwm8vuRuWIS/iZQAVfObonyyFJb3EszPe/IAfzLpy9NrhqxK1AOtfvq5Y9Xe3pgJRVS4TURprM6ZQy3nBEVCfMmh6G5ugCLlW39bfTg+w7znARBgoN6tyDJeHUggCTIuBd5TV3KdeCyoiue5xRGOsiD3G+lxTR7JgNBIHzn3Br2r/nRrrR4mPcMDw/ScuY+X2qwvqCHHCBdXgqnFcoy3S7g7Uq+oSoGSGkDUTNzfnOOhe+WfYEq2dY4c=----ATTACHMENT:----ODE0ODYxMzg0MDc3Mzg4MiA2Mjc0ODQyNTIwODA5MzIyIDEyNzc5NTk1NjU1ODU4NDI=