You are here

public function WebAssertTest::testElementsCount in Zircon Profile 8.0

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

File

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

Class

WebAssertTest

Namespace

Behat\Mink\Tests

Code

public function testElementsCount() {
  $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(2))
    ->method('findAll')
    ->with('css', 'h2 > span')
    ->will($this
    ->returnValue(array(
    1,
    2,
  )));
  $this
    ->assertCorrectAssertion('elementsCount', array(
    'css',
    'h2 > span',
    2,
  ));
  $this
    ->assertWrongAssertion('elementsCount', array(
    'css',
    'h2 > span',
    3,
  ), 'Behat\\Mink\\Exception\\ExpectationException', '2 elements matching css "h2 > span" found on the page, but should be 3.');
}