$xml->appendChild('child', true)->setAttribute('attr1', 'Attr1 Value')->setAttribute('attr2', 'Attr2 Value')->setAttribute('attr2', 'Attr2 New Value'); $expected = "<doc>\n" . " <child attr1=\"Attr1 Value\" attr2=\"Attr2 New Value\"/>\n" . "</doc>"; assert_equal_xml($xml, $expected); $xml = new FluidXml(); $xml->appendChild('child', true)->setAttribute(['attr1' => 'Attr1 Value', 'attr2' => 'Attr2 Value'])->setAttribute('attr1', 'Attr1 New Value'); $expected = "<doc>\n" . " <child attr1=\"Attr1 New Value\" attr2=\"Attr2 Value\"/>\n" . "</doc>"; assert_equal_xml($xml, $expected); }); }); describe('.appendText', function () { it('should be fluid', function () { assert_is_fluid('appendText', 'a'); }); it('should add text to the root node', function () { $xml = new FluidXml(); $xml->appendText('First Line')->appendText('Second Line'); $expected = "<doc>First LineSecond Line</doc>"; assert_equal_xml($xml, $expected); }); it('should add text to a node', function () { $xml = new FluidXml(); $cx = $xml->appendChild('p', true); $cx->appendText('First Line')->appendText('Second Line'); $expected = "<doc>\n" . " <p>First LineSecond Line</p>\n" . "</doc>"; assert_equal_xml($xml, $expected); }); }); describe('.setText', function () { it('should be fluid', function () { assert_is_fluid('setText', 'a'); });