public function WebAssertTest::testElementAttributeExists in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink/tests/WebAssertTest.php \Behat\Mink\Tests\WebAssertTest::testElementAttributeExists()
File
- vendor/
behat/ mink/ tests/ WebAssertTest.php, line 937
Class
Namespace
Behat\Mink\TestsCode
public function testElementAttributeExists() {
$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
->at(0))
->method('hasAttribute')
->with('name')
->will($this
->returnValue(true));
$element
->expects($this
->at(1))
->method('hasAttribute')
->with('name')
->will($this
->returnValue(false));
$this
->assertCorrectAssertion('elementAttributeExists', array(
'css',
'h2 > span',
'name',
));
$this
->assertWrongAssertion('elementAttributeExists', array(
'css',
'h2 > span',
'name',
), 'Behat\\Mink\\Exception\\ElementHtmlException', 'The attribute "name" was not found in the element matching css "h2 > span".');
}