You are here

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

File

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

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

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