\assert($actual === $expected, __($actual, $expected)); $actual = "{$cx}"; $expected = "<parent>\n" . " <child1/>\n" . " <child2/>\n" . "</parent>"; \assert($actual === $expected, __($actual, $expected)); }); }); describe('.html()', function () { it('should return the document as valid HTML 5 string', function () { $xml = new FluidXml(['html' => ['body' => ['input', 'div']]]); $actual = $xml->html(); $expected = "<!DOCTYPE html>\n" . "<html>\n" . " <body>\n" . " <input/>\n" . " <div></div>\n" . " </body>\n" . "</html>"; \assert($actual === $expected, __($actual, $expected)); }); it('should return the document as valid HTML 5 string without the doctype', function () { $xml = new FluidXml(['html' => ['body' => ['input', 'div']]]); $actual = $xml->html(true); $expected = "<html>\n" . " <body>\n" . " <input/>\n" . " <div></div>\n" . " </body>\n" . "</html>"; \assert($actual === $expected, __($actual, $expected)); }); it('should return a node and the descendants as HTML string', function () { $xml = new FluidXml(['html' => ['body' => ['input', 'div']]]); $actual = $xml->query('//body/*')->html(); $expected = "<input/>\n" . "<div></div>"; \assert($actual === $expected, __($actual, $expected)); }); }); describe('.save()', function () { it('should be fluid', function () { $file = "{$this->out_dir}.test_save0.xml"; assert_is_fluid('save', $file); \unlink($file);