You are here

public function NodeElementTest::testSelectOption in Zircon Profile 8

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

File

vendor/behat/mink/tests/Element/NodeElementTest.php, line 280

Class

NodeElementTest

Namespace

Behat\Mink\Tests\Element

Code

public function testSelectOption() {
  $node = new NodeElement('select', $this->session);
  $option = $this
    ->getMockBuilder('Behat\\Mink\\Element\\NodeElement')
    ->disableOriginalConstructor()
    ->getMock();
  $option
    ->expects($this
    ->once())
    ->method('getValue')
    ->will($this
    ->returnValue('item1'));
  $this->driver
    ->expects($this
    ->once())
    ->method('getTagName')
    ->with('select')
    ->will($this
    ->returnValue('select'));
  $this->driver
    ->expects($this
    ->once())
    ->method('find')
    ->with('select/option')
    ->will($this
    ->returnValue(array(
    $option,
  )));
  $this->selectors
    ->expects($this
    ->once())
    ->method('selectorToXpath')
    ->with('named_exact', array(
    'option',
    'item1',
  ))
    ->will($this
    ->returnValue('option'));
  $this->driver
    ->expects($this
    ->once())
    ->method('selectOption')
    ->with('select', 'item1', false);
  $node
    ->selectOption('item1');
}