public function testFirstChild() { $html = '<ul><li>One</li><li>Two</li><li>Three</li></ul>'; $document = new Document($html, false); $list = $document->first('ul'); $this->assertEquals($list->getNode()->firstChild, $list->firstChild()->getNode()); $list = new Element('ul'); $this->assertNull($list->firstChild()); // with text nodes $html = '<p>Foo <span>Bar</span> Baz</p>'; $document = new Document($html, false); $paragraph = $document->first('p'); $firstChild = $paragraph->getNode()->firstChild; $this->assertEquals($firstChild, $paragraph->firstChild()->getNode()); }