You are here

public function CrawlerTest::testFilterXPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Tests/CrawlerTest.php \Symfony\Component\DomCrawler\Tests\CrawlerTest::testFilterXPath()

@covers Symfony\Component\DomCrawler\Crawler::filterXPath

File

vendor/symfony/dom-crawler/Tests/CrawlerTest.php, line 436

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testFilterXPath() {
  $crawler = $this
    ->createTestCrawler();
  $this
    ->assertNotSame($crawler, $crawler
    ->filterXPath('//li'), '->filterXPath() returns a new instance of a crawler');
  $this
    ->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->filterXPath() returns a new instance of a crawler');
  $crawler = $this
    ->createTestCrawler()
    ->filterXPath('//ul');
  $this
    ->assertCount(6, $crawler
    ->filterXPath('//li'), '->filterXPath() filters the node list with the XPath expression');
  $crawler = $this
    ->createTestCrawler();
  $this
    ->assertCount(3, $crawler
    ->filterXPath('//body')
    ->filterXPath('//button')
    ->parents(), '->filterXpath() preserves parents when chained');
}