}); }); describe('simplexml_to_string_without_headers', function () { it('should convert a SimpleXMLElement instance to an XML string without the XML headers (declaration and stylesheets)', function () { $xml = \simplexml_import_dom((new FluidXml())->dom()); $actual = simplexml_to_string_without_headers($xml); $expected = "<doc/>"; \assert($actual === $expected, __($actual, $expected)); }); }); describe('FluidXml', function () { $ds = \DIRECTORY_SEPARATOR; $this->out_dir = __DIR__ . "{$ds}..{$ds}sandbox{$ds}"; it('should throw invoking not existing staic method', function () { try { FluidXml::lload(); } catch (\Exception $e) { $actual = $e; } assert_is_a($actual, \Exception::class); }); describe(':load', function () { $doc = "<root>\n" . " <parent>content</parent>\n" . "</root>"; $dom = new \DOMDocument(); $dom->loadXML($doc); it('should import an XML string', function () use($doc, $dom) { $exp = $dom->saveXML(); // This $exp has the XML header. // The first empty line is used to test the trim of the string. $xml = FluidXml::load("\n " . $exp); $expected = $doc;