}); it('should set/change the text of a node', function () { $xml = new FluidXml(); $cx = $xml->appendChild('p', true); $cx->setText('First Text')->setText('Second Text'); $expected = "<doc>\n" . " <p>Second Text</p>\n" . "</doc>"; assert_equal_xml($xml, $expected); }); }); describe('.appendCdata', function () { it('should be fluid', function () { assert_is_fluid('appendCdata', 'a'); }); it('should add CDATA to the root node', function () { $xml = new FluidXml(); $xml->appendCdata('// <, > are characters that should be escaped in a XML context.')->appendCdata('// Even & is a characters that should be escaped in a XML context.'); $expected = "<doc>" . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>" . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>" . "</doc>"; assert_equal_xml($xml, $expected); }); it('should add CDATA to a node', function () { $xml = new FluidXml(); $cx = $xml->appendChild('pre', true); $cx->appendCdata('// <, > are characters that should be escaped in a XML context.')->appendCdata('// Even & is a characters that should be escaped in a XML context.'); $expected = "<doc>\n" . " <pre>" . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>" . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>" . "</pre>\n" . "</doc>"; assert_equal_xml($xml, $expected); }); }); describe('.setCdata', function () { it('should be fluid', function () { assert_is_fluid('setCdata', 'a'); });