You are here

protected function Mink::locateSession in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/Mink.php \Behat\Mink\Mink::locateSession()

Returns the named or default session without starting it.

Parameters

string $name session name:

Return value

Session

Throws

\InvalidArgumentException If the named session is not registered

2 calls to Mink::locateSession()
Mink::getSession in vendor/behat/mink/src/Mink.php
Returns registered session by it's name or active one and automatically starts it if required.
Mink::isSessionStarted in vendor/behat/mink/src/Mink.php
Checks whether a named session (or the default session) has already been started.

File

vendor/behat/mink/src/Mink.php, line 200

Class

Mink
Mink sessions manager.

Namespace

Behat\Mink

Code

protected function locateSession($name = null) {
  $name = strtolower($name) ?: $this->defaultSessionName;
  if (null === $name) {
    throw new \InvalidArgumentException('Specify session name to get');
  }
  if (!isset($this->sessions[$name])) {
    throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name));
  }
  $session = $this->sessions[$name];
  return $session;
}