You are here

public function WebAssertTest::testElementNotExists in Zircon Profile 8

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

File

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

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testElementNotExists() {
  $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(null, 1, null, 1));
  $this
    ->assertCorrectAssertion('elementNotExists', array(
    'css',
    'h2 > span',
  ));
  $this
    ->assertWrongAssertion('elementNotExists', array(
    'css',
    'h2 > span',
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'An element matching css "h2 > span" appears on this page, but it should not.');
  $this
    ->assertCorrectAssertion('elementNotExists', array(
    'css',
    'h2 > span',
    $page,
  ));
  $this
    ->assertWrongAssertion('elementNotExists', array(
    'css',
    'h2 > span',
    $page,
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'An element matching css "h2 > span" appears on this page, but it should not.');
}