You are here

public function WebAssertTest::testElementExists in Zircon Profile 8

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

File

vendor/behat/mink/tests/WebAssertTest.php, line 582

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testElementExists() {
  $page = $this
    ->getMockBuilder('Behat\\Mink\\Element\\DocumentElement')
    ->disableOriginalConstructor()
    ->getMock();
  $this->session
    ->expects($this
    ->exactly(2))
    ->method('getPage')
    ->will($this
    ->returnValue($page));
  $page
    ->expects($this
    ->exactly(4))
    ->method('find')
    ->with('css', 'h2 > span')
    ->will($this
    ->onConsecutiveCalls(1, null, 1, null));
  $this
    ->assertCorrectAssertion('elementExists', array(
    'css',
    'h2 > span',
  ));
  $this
    ->assertWrongAssertion('elementExists', array(
    'css',
    'h2 > span',
  ), 'Behat\\Mink\\Exception\\ElementNotFoundException', 'Element matching css "h2 > span" not found.');
  $this
    ->assertCorrectAssertion('elementExists', array(
    'css',
    'h2 > span',
    $page,
  ));
  $this
    ->assertWrongAssertion('elementExists', array(
    'css',
    'h2 > span',
    $page,
  ), 'Behat\\Mink\\Exception\\ElementNotFoundException', 'Element matching css "h2 > span" not found.');
}