Esempio n. 1
0
         $xml = new FluidXml();
         $xml->appendChild('parent', true)->appendSibling('sibling1')->appendSibling('sibling2');
         $expected = "<doc>\n" . "  <parent/>\n" . "  <sibling2/>\n" . "  <sibling1/>\n" . "</doc>";
         assert_equal_xml($xml, $expected);
     });
 });
 describe('.appendXml', function () {
     it('should fill the document with an xml document', function () {
         $xml = new FluidXml(['root' => null]);
         $xml->appendXml('<root1/><root2/>');
         $expected = "<root1/>\n" . "<root2/>";
         assert_equal_xml($xml, $expected);
     });
     it('should add to the document an xml document', function () {
         $xml = new FluidXml();
         $xml->appendXml('<child1/><child2/>');
         $expected = "<doc>\n" . "  <child1/>\n" . "  <child2/>\n" . "</doc>";
         assert_equal_xml($xml, $expected);
     });
     it('should add to a node an xml document', function () {
         $xml = new FluidXml();
         $xml->appendChild('parent', true)->appendXml('<child1/><child2/>');
         $expected = "<doc>\n" . "  <parent>\n" . "    <child1/>\n" . "    <child2/>\n" . "  </parent>\n" . "</doc>";
         assert_equal_xml($xml, $expected);
     });
 });
 describe('.setAttribute', function () {
     it('should set the attributes of the root node', function () {
         $xml = new FluidXml();
         $xml->setAttribute('attr1', 'Attr1 Value')->setAttribute('attr2', 'Attr2 Value');
         $expected = "<doc attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>";