You are here

public function DocumentElementTest::testFind in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/tests/Element/DocumentElementTest.php \Behat\Mink\Tests\Element\DocumentElementTest::testFind()

File

vendor/behat/mink/tests/Element/DocumentElementTest.php, line 55

Class

DocumentElementTest

Namespace

Behat\Mink\Tests\Element

Code

public function testFind() {
  $this->driver
    ->expects($this
    ->exactly(3))
    ->method('find')
    ->with('//html/h3[a]')
    ->will($this
    ->onConsecutiveCalls(array(
    2,
    3,
    4,
  ), array(
    1,
    2,
  ), array()));
  $xpath = 'h3[a]';
  $css = 'h3 > a';
  $this->selectors
    ->expects($this
    ->exactly(3))
    ->method('selectorToXpath')
    ->will($this
    ->returnValueMap(array(
    array(
      'xpath',
      $xpath,
      $xpath,
    ),
    array(
      'xpath',
      $xpath,
      $xpath,
    ),
    array(
      'css',
      $css,
      $xpath,
    ),
  )));
  $this
    ->assertEquals(2, $this->document
    ->find('xpath', $xpath));
  $this
    ->assertEquals(1, $this->document
    ->find('css', $css));
  $this
    ->assertNull($this->document
    ->find('xpath', $xpath));
}