public function CrawlerTest::testParents 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::testParents()
File
- vendor/
symfony/ dom-crawler/ Tests/ CrawlerTest.php, line 933
Class
Namespace
Symfony\Component\DomCrawler\TestsCode
public function testParents() {
$crawler = $this
->createTestCrawler()
->filterXPath('//li[1]');
$this
->assertNotSame($crawler, $crawler
->parents(), '->parents() returns a new instance of a crawler');
$this
->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->parents() returns a new instance of a crawler');
$nodes = $crawler
->parents();
$this
->assertEquals(3, $nodes
->count());
$nodes = $this
->createTestCrawler()
->filterXPath('//html')
->parents();
$this
->assertEquals(0, $nodes
->count());
try {
$this
->createTestCrawler()
->filterXPath('//ol')
->parents();
$this
->fail('->parents() throws an \\InvalidArgumentException if the node list is empty');
} catch (\InvalidArgumentException $e) {
$this
->assertTrue(true, '->parents() throws an \\InvalidArgumentException if the node list is empty');
}
}