setComment() public method

public setComment ( $text )
Ejemplo n.º 1
0
     });
     it('should set/change the comment of a node', function () {
         $xml = new FluidXml();
         $cx = $xml->addChild('p', true);
         $cx->setComment('First')->setComment('Second');
         $expected = "<doc>\n" . "  <p><!--Second--></p>\n" . "</doc>";
         assert_equal_xml($xml, $expected);
     });
 });
 describe('.comment()', function () {
     it('should be fluid', function () {
         assert_is_fluid('comment', 'a');
     });
     it('should behave like .setComment()', function () {
         $xml = new FluidXml();
         $xml->setComment('Text1')->addChild('child', true)->setComment('Text2');
         $alias = new FluidXml();
         $alias->comment('Text1')->addChild('child', true)->comment('Text2');
         $actual = $xml->xml();
         $expected = $alias->xml();
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.addComment()', function () {
     it('should be fluid', function () {
         assert_is_fluid('addComment', 'a');
     });
     it('should add comments to the root node', function () {
         $xml = new FluidXml();
         $xml->addComment('First')->addComment('Second');
         $expected = "<doc>\n" . "  <!--First-->\n" . "  <!--Second-->\n" . "</doc>";