本文整理汇总了PHP中Behat\Mink\Session::getDriver方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getDriver方法的具体用法?PHP Session::getDriver怎么用?PHP Session::getDriver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Mink\Session
的用法示例。
在下文中一共展示了Session::getDriver方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMessageElement
/**
* @return NodeElement
*
* @throws ElementNotFoundException
*/
private function getMessageElement()
{
$messageElement = $this->session->getPage()->find('css', self::NOTIFICATION_ELEMENT_CSS);
if (null === $messageElement) {
throw new ElementNotFoundException($this->session->getDriver(), 'message element', 'css', self::NOTIFICATION_ELEMENT_CSS);
}
return $messageElement;
}
示例2: prepareMinkSessionIfNeeded
private function prepareMinkSessionIfNeeded()
{
if ($this->minkSession->getDriver() instanceof KernelDriver) {
return;
}
if (false !== strpos($this->minkSession->getCurrentUrl(), $this->minkParameters['base_url'])) {
return;
}
$this->minkSession->visit(rtrim($this->minkParameters['base_url'], '/') . '/');
}
示例3: prepareSessionIfNeeded
private function prepareSessionIfNeeded()
{
if (!$this->minkSession->getDriver() instanceof Selenium2Driver) {
return;
}
if (false !== strpos($this->minkSession->getCurrentUrl(), $this->minkParameters['base_url'])) {
return;
}
$this->homePage->open();
}
示例4: __construct
/**
* Initialize element.
*
* @param Session $session
*/
public function __construct(Session $session)
{
$this->xpathManipulator = new Manipulator();
$this->session = $session;
$this->driver = $session->getDriver();
$this->selectorsHandler = $session->getSelectorsHandler();
}
示例5:
function it_loads_base_url_and_sets_a_cookie_if_not_using_kernel_driver_and_driver_is_currently_outside_base_url(Session $minkSession, DriverInterface $driver)
{
$minkSession->getDriver()->willReturn($driver);
$minkSession->getCurrentUrl()->willReturn('http://sylius.org');
$minkSession->visit('http://localhost:8080/')->shouldBeCalled();
$minkSession->setCookie('abc', 'def')->shouldBeCalled();
$this->setCookie('abc', 'def');
}
示例6: getSymfonyDriver
/**
* Get the Symfony driver.
*
* @return BrowserKitDriver
*
* @throws UnsupportedDriverActionException when not using mink browser kit driver
*/
protected function getSymfonyDriver()
{
$driver = $this->session->getDriver();
if ($driver instanceof BrowserKitDriver === false) {
throw new UnsupportedDriverActionException('Not using the Symfony Driver - current driver is %s', $driver);
}
return $driver;
}
示例7: getResponseInfo
/**
* Returns response information string.
*
* @return string
*/
protected function getResponseInfo()
{
$driver = basename(str_replace('\\', '/', get_class($this->session->getDriver())));
$info = '+--[ ';
if (!in_array($driver, array('SahiDriver', 'SeleniumDriver'))) {
$info .= 'HTTP/1.1 ' . $this->session->getStatusCode() . ' | ';
}
$info .= $this->session->getCurrentUrl() . ' | ' . $driver . " ]\n|\n";
return $info;
}
示例8: __construct
/**
* Initializes exception.
*
* @param string $message optional message
* @param DriverInterface|Session $driver driver instance (or session for BC)
* @param \Exception|null $exception expectation exception
*/
public function __construct($message, $driver, \Exception $exception = null)
{
if ($driver instanceof Session) {
@trigger_error('Passing a Session object to the ExpectationException constructor is deprecated as of Mink 1.7. Pass the driver instead.', E_USER_DEPRECATED);
$this->session = $driver;
$this->driver = $driver->getDriver();
} elseif (!$driver instanceof DriverInterface) {
// Trigger an exception as we cannot typehint a disjunction
throw new \InvalidArgumentException('The ExpectationException constructor expects a DriverInterface or a Session.');
} else {
$this->driver = $driver;
}
if (!$message && null !== $exception) {
$message = $exception->getMessage();
}
parent::__construct($message, 0, $exception);
}
示例9: getDriver
/**
* @return DriverInterface
*/
protected function getDriver()
{
return $this->session->getDriver();
}
示例10: testGetDriver
public function testGetDriver()
{
$this->assertSame($this->driver, $this->session->getDriver());
}
示例11: _sendRequest
public function _sendRequest($url)
{
$this->session->visit($url);
return $this->session->getDriver()->getContent();
}
示例12: getSessionId
/**
* Get Selenium2 current session id.
*
* @param Session $session Session.
*
* @return string
* @throws \RuntimeException When session was created using an unsupported driver.
*/
protected function getSessionId(Session $session)
{
$driver = $session->getDriver();
if ($driver instanceof Selenium2Driver) {
return $driver->getWebDriverSessionId();
}
throw new \RuntimeException('Unsupported session driver');
}
示例13: getRequestDataLogMessage
/**
* @param Session $session
*
* @return string|null
*/
private function getRequestDataLogMessage(Session $session)
{
$driver = $session->getDriver();
if (!$driver instanceof BrowserKitDriver) {
return null;
}
try {
return 'Request:' . "\n" . print_r($driver->getClient()->getRequest(), true) . "\n";
} catch (MinkException $exception) {
return null;
}
}
示例14: getClient
/**
* @return Client
*/
private function getClient()
{
return $this->session->getDriver()->getClient();
}