public function CrawlerTest::testHtml in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Tests/CrawlerTest.php \Symfony\Component\DomCrawler\Tests\CrawlerTest::testHtml()
File
- vendor/
symfony/ dom-crawler/ Tests/ CrawlerTest.php, line 387
Class
Namespace
Symfony\Component\DomCrawler\TestsCode
public function testHtml() {
$this
->assertEquals('<img alt="Bar">', $this
->createTestCrawler()
->filterXPath('//a[5]')
->html());
$this
->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim($this
->createTestCrawler()
->filterXPath('//form[@id="FooFormId"]')
->html()));
try {
$this
->createTestCrawler()
->filterXPath('//ol')
->html();
$this
->fail('->html() throws an \\InvalidArgumentException if the node list is empty');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(true, '->html() throws an \\InvalidArgumentException if the node list is empty');
}
}