Ejemplo n.º 1
0
 public function testBuildToString()
 {
     $this->attrs->disableValidation();
     $this->attrs->add('my-attr', 'my-value')->add('id', '9993')->add('class', 'my-class');
     $expected = 'my-attr="my-value" id="9993" class="my-class"';
     $this->expectOutputString($expected);
     echo $this->attrs;
 }
Ejemplo n.º 2
0
 /**
  * @return
  */
 public function testContstructorAllParams()
 {
     $tagName = 'title';
     $content = new TagContent();
     $attrs = new TagAttributes(array('my-attr'));
     $lockTagName = false;
     $tag = new GenericTag($tagName, $content, $attrs, $lockTagName);
     $attr1 = 'my-value';
     $this->assertFalse($attrs->exists('my-attr'));
     $this->assertSame($tag, $tag->addAttribute('my-attr', $attr1));
     $this->assertTrue($attrs->exists('my-attr'));
     $this->assertEquals($attr1, $attrs->get('my-attr'));
     $text1 = 'text block 1';
     $this->assertSame($tag, $tag->addContent($text1));
     $this->assertEquals($text1, $content->get(0));
     /* should be able to change the tag name now */
     $this->assertSame($tag, $tag->setTagName('link'));
     $this->assertEquals('link', $tag->getTagName());
 }