$xml = new FluidXml();
$xml->setComment('Text1')->addChild('child', true)->setComment('Text2');
$alias = new FluidXml();
$alias->comment('Text1')->addChild('child', true)->comment('Text2');
$actual = $xml->xml();
$expected = $alias->xml();
\assert($actual === $expected, __($actual, $expected));
});
});
describe('.addComment()', function () {
it('should be fluid', function () {
assert_is_fluid('addComment', 'a');
});
it('should add comments to the root node', function () {
$xml = new FluidXml();
$xml->addComment('First')->addComment('Second');
$expected = "<doc>\n" . " <!--First-->\n" . " <!--Second-->\n" . "</doc>";
assert_equal_xml($xml, $expected);
});
it('should add comments to a node', function () {
$xml = new FluidXml();
$cx = $xml->addChild('pre', true);
$cx->addComment('First')->addComment('Second');
$expected = "<doc>\n" . " <pre>\n" . " <!--First-->\n" . " <!--Second-->\n" . " </pre>\n" . "</doc>";
assert_equal_xml($xml, $expected);
});
});
describe('.remove()', function () {
$expected = "<doc>\n" . " <parent/>\n" . "</doc>";
$new_doc = function () {
$xml = new FluidXml();