You are here

public function WebAssertTest::testElementTextContains in Zircon Profile 8

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

File

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

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testElementTextContains() {
  $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('find')
    ->with('css', 'h2 > span')
    ->will($this
    ->returnValue($element));
  $element
    ->expects($this
    ->exactly(2))
    ->method('getText')
    ->will($this
    ->returnValue('element text'));
  $this
    ->assertCorrectAssertion('elementTextContains', array(
    'css',
    'h2 > span',
    'text',
  ));
  $this
    ->assertWrongAssertion('elementTextContains', array(
    'css',
    'h2 > span',
    'html',
  ), 'Behat\\Mink\\Exception\\ExpectationException', 'The text "html" was not found in the text of the element matching css "h2 > span".');
}