You are here

public function CrawlerTest::testLinks 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::testLinks()

File

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

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testLinks() {
  $crawler = $this
    ->createTestCrawler('http://example.com/bar/')
    ->selectLink('Foo');
  $this
    ->assertInternalType('array', $crawler
    ->links(), '->links() returns an array');
  $this
    ->assertCount(4, $crawler
    ->links(), '->links() returns an array');
  $links = $crawler
    ->links();
  $this
    ->assertInstanceOf('Symfony\\Component\\DomCrawler\\Link', $links[0], '->links() returns an array of Link instances');
  $this
    ->assertEquals(array(), $this
    ->createTestCrawler()
    ->filterXPath('//ol')
    ->links(), '->links() returns an empty array if the node selection is empty');
}