$xml = new FluidXml(); $xml->setText('Text1')->appendChild('child', true)->setText('Text2'); $alias = new FluidXml(); $alias->text('Text1')->appendChild('child', true)->text('Text2'); $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 = [];