You are here

public function WebAssertTest::testFieldExists in Zircon Profile 8.0

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

File

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

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testFieldExists() {
  $page = $this
    ->getMockBuilder('Behat\\Mink\\Element\\DocumentElement')
    ->disableOriginalConstructor()
    ->getMock();
  $element = $this
    ->getMockBuilder('Behat\\Mink\\Element\\NodeElement')
    ->disableOriginalConstructor()
    ->getMock();
  $this->session
    ->expects($this
    ->exactly(2))
    ->method('getPage')
    ->will($this
    ->returnValue($page));
  $page
    ->expects($this
    ->exactly(2))
    ->method('findField')
    ->with('username')
    ->will($this
    ->onConsecutiveCalls($element, null));
  $this
    ->assertCorrectAssertion('fieldExists', array(
    'username',
  ));
  $this
    ->assertWrongAssertion('fieldExists', array(
    'username',
  ), 'Behat\\Mink\\Exception\\ElementNotFoundException', 'Form field with id|name|label|value "username" not found.');
}