You are here

public function NamedSelectorTest::testSelectors in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/tests/Selector/NamedSelectorTest.php \Behat\Mink\Tests\Selector\NamedSelectorTest::testSelectors()

@dataProvider getSelectorTests

1 call to NamedSelectorTest::testSelectors()
NamedSelectorTest::testEscapedSelectors in vendor/behat/mink/tests/Selector/NamedSelectorTest.php
@dataProvider getSelectorTests @group legacy

File

vendor/behat/mink/tests/Selector/NamedSelectorTest.php, line 35

Class

NamedSelectorTest

Namespace

Behat\Mink\Tests\Selector

Code

public function testSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount = null) {
  $expectedCount = $this
    ->allowPartialMatch() && null !== $expectedPartialCount ? $expectedPartialCount : $expectedExactCount;

  // Don't use "loadHTMLFile" due HHVM 3.3.0 issue.
  $dom = new \DOMDocument('1.0', 'UTF-8');
  $dom
    ->loadHTML(file_get_contents(__DIR__ . '/fixtures/' . $fixtureFile));
  $namedSelector = $this
    ->getSelector();
  $xpath = $namedSelector
    ->translateToXPath(array(
    $selector,
    $locator,
  ));
  $domXpath = new \DOMXPath($dom);
  $nodeList = $domXpath
    ->query($xpath);
  $this
    ->assertEquals($expectedCount, $nodeList->length);
}