You are here

public function WebAssertTest::testFieldValueEquals in Zircon Profile 8

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

File

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

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testFieldValueEquals() {
  $page = $this
    ->getMockBuilder('Behat\\Mink\\Element\\DocumentElement')
    ->disableOriginalConstructor()
    ->getMock();
  $element = $this
    ->getMockBuilder('Behat\\Mink\\Element\\NodeElement')
    ->disableOriginalConstructor()
    ->getMock();
  $this->session
    ->expects($this
    ->exactly(4))
    ->method('getPage')
    ->will($this
    ->returnValue($page));
  $page
    ->expects($this
    ->exactly(4))
    ->method('findField')
    ->with('username')
    ->will($this
    ->returnValue($element));
  $element
    ->expects($this
    ->exactly(4))
    ->method('getValue')
    ->will($this
    ->returnValue(234));
  $this
    ->assertCorrectAssertion('fieldValueEquals', array(
    'username',
    234,
  ));
  $this
    ->assertWrongAssertion('fieldValueEquals', array(
    'username',
    235,
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'The field "username" value is "234", but "235" expected.');
  $this
    ->assertWrongAssertion('fieldValueEquals', array(
    'username',
    23,
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'The field "username" value is "234", but "23" expected.');
  $this
    ->assertWrongAssertion('fieldValueEquals', array(
    'username',
    '',
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'The field "username" value is "234", but "" expected.');
}