webDriverKeyboard = $this->getMock('Facebook\WebDriver\WebDriverKeyboard'); $this->webDriverMouse = $this->getMock('Facebook\WebDriver\WebDriverMouse'); $this->locationProvider = $this->getMock('Facebook\WebDriver\Internal\WebDriverLocatable'); $this->keys = array('t', 'e', 's', 't'); $this->webDriverSendKeysAction = new WebDriverSendKeysAction( $this->webDriverKeyboard, $this->webDriverMouse, $this->locationProvider, $this->keys ); } public function testPerformFocusesOnElementAndSendPressKeyCommand() { $coords = $this->getMockBuilder('Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates') ->disableOriginalConstructor()->getMock(); $this->webDriverKeyboard->expects($this->once())->method('sendKeys')->with($this->keys); $this->webDriverMouse->expects($this->once())->method('click')->with($coords); $this->locationProvider->expects($this->once())->method('getCoordinates')->will($this->returnValue($coords)); $this->webDriverSendKeysAction->perform(); } }