Esempio n. 1
0
     it('should behave like .appendSibling', function () {
         $xml = new FluidXml();
         $xml->appendSibling('sibling1', true)->appendSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();
         $alias->insertSiblingAfter('sibling1', true)->insertSiblingAfter(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.attr', function () {
     it('should behave like .setAttribute', function () {
         $xml = new FluidXml();
         $xml->setAttribute('attr1', 'Attr1 Value')->setAttribute(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])->appendChild('child', true)->setAttribute('attr4', 'Attr4 Value')->setAttribute(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
         $alias = new FluidXml();
         $alias->attr('attr1', 'Attr1 Value')->attr(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])->appendChild('child', true)->attr('attr4', 'Attr4 Value')->attr(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.text', function () {
     it('should behave like .setText', function () {
         $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));
     });