Esempio n. 1
0
 /**
  * @dataProvider provideTestToStringConsSetters
  */
 public function testToStringConsSetters($tagname, $content, $attributes, $html)
 {
     $tag1 = new HTMLTag($tagname, $content, $attributes);
     $this->assertEquals((string) $tag1, $html);
     $this->assertEquals($tag1->html(), $html);
     /* wir versuchen noch andere methoden das tag zu erstellen */
     $tag2 = new HTMLTag($tagname);
     $tag2->setContent($content);
     $tag2->setAttributes($attributes);
     $this->assertEquals((string) $tag2, $html);
     $this->assertEquals($tag2->html(), $html);
     $tag3 = fHTML::tag($tagname, $content, $attributes);
     $this->assertEquals((string) $tag3, $html);
     $this->assertEquals($tag3->html(), $html);
     $tag4 = fHTML::tag($tagname)->setContent($content)->setAttributes($attributes);
     $this->assertEquals((string) $tag4, $html);
     $this->assertEquals($tag4->html(), $html);
     $tag5 = clone $tag4;
     if (is_array($attributes)) {
         foreach ($attributes as $key => $attr) {
             $tag5->setAttribute($key, $attr);
         }
     }
     $this->assertEquals((string) $tag4, (string) $tag5);
     $this->assertEquals($tag4->html(), $html);
 }
Esempio n. 2
0
 /**
  * 
  * @param HTMLTag $element An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.
  * @return HTMLTag
  */
 public function wrap(Tag $element)
 {
     $inner = clone $this;
     return $element->setContent($inner);
 }