Skip to content

Commit a116fe1

Browse files
committed
Added test for ticket paquettg#146
1 parent dbbfe74 commit a116fe1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Node/HtmlTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,17 @@ public function testReplaceNode()
501501
$dom->find('p')[0]->getParent()->replaceChild($id, $newChild);
502502
$this->assertEquals('<div class="all"><h1></h1></div>', (string) $dom);
503503
}
504+
505+
public function testTextNodeFirstChild()
506+
{
507+
$dom = new Dom;
508+
$dom->load('<div class="all"><p>Hey bro, <a href="google.com">click here</a><br /> :)</p></div>');
509+
$p = $dom->find('p');
510+
foreach ($p as $element)
511+
{
512+
$child = $element->firstChild();
513+
$this->assertInstanceOf(TextNode::class, $child);
514+
break;
515+
}
516+
}
504517
}

0 commit comments

Comments
 (0)