public function CrawlerTest::testAttr 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::testAttr()
File
- vendor/
symfony/ dom-crawler/ Tests/ CrawlerTest.php, line 340
Class
Namespace
Symfony\Component\DomCrawler\TestsCode
public function testAttr() {
$this
->assertEquals('first', $this
->createTestCrawler()
->filterXPath('//li')
->attr('class'), '->attr() returns the attribute of the first element of the node list');
try {
$this
->createTestCrawler()
->filterXPath('//ol')
->attr('class');
$this
->fail('->attr() throws an \\InvalidArgumentException if the node list is empty');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(true, '->attr() throws an \\InvalidArgumentException if the node list is empty');
}
}