Пример #1
0
 public function testMultipleContentAtSameLevel()
 {
     /**
      * It should generates:
      *
      * <div id="main">
      *     <p class="comment">First content</p>
      *     <a role="navigation" href="/home">Go Home!</a>
      * </div>
      */
     $content_tag = new ContentTag('div', ['class' => 'main'], function () {
         return [new ContentTag('p', 'First content', ['class' => 'comment']), new ContentTag('a', ['role' => 'navigation', 'href' => '/home'])];
     });
     $html = $content_tag->get_html();
     $this->assertEquals(2, $html->get_content()->length());
     $first_child = $html->get_child(0);
     $second_child = $html->get_child(1);
     $this->assertTrue($first_child->is_a('p', ['class' => 'comment']));
     $this->assertTrue($second_child->is_a('a'));
 }