$actual = $xml->xml();
$expected = $alias->xml();
\assert($actual === $expected, __($actual, $expected));
});
});
describe('.cdata', function () {
it('should be fluid', function () {
assert_is_fluid('cdata', 'a');
});
it('should behave like .setCdata', function () {
$xml = new FluidXml();
$xml->setCdata('Text1')->appendChild('child', true)->setCdata('Text2');
$alias = new FluidXml();
$alias->cdata('Text1')->appendChild('child', true)->cdata('Text2');
$actual = $xml->xml();
$expected = $alias->xml();
\assert($actual === $expected, __($actual, $expected));
});
});
});
describe('FluidContext', function () {
it('should be iterable returning the represented DOMNode objects', function () {
$xml = new FluidXml();
$cx = $xml->appendChild(['head', 'body'], true);
$actual = $cx;
assert_is_a($actual, \Iterator::class);
$representation = [];
foreach ($cx as $k => $v) {
$actual = \is_int($k);
$expected = true;
\assert($actual === $expected, __($actual, $expected));