You are here

public function CrawlerTest::testText in Zircon Profile 8.0

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

File

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

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testText() {
  $this
    ->assertEquals('One', $this
    ->createTestCrawler()
    ->filterXPath('//li')
    ->text(), '->text() returns the node value of the first element of the node list');
  try {
    $this
      ->createTestCrawler()
      ->filterXPath('//ol')
      ->text();
    $this
      ->fail('->text() throws an \\InvalidArgumentException if the node list is empty');
  } catch (\InvalidArgumentException $e) {
    $this
      ->assertTrue(true, '->text() throws an \\InvalidArgumentException if the node list is empty');
  }
}