class Session in Zircon Profile 8
Same name in this branch
- 8 vendor/behat/mink/src/Session.php \Behat\Mink\Session
- 8 vendor/symfony/http-foundation/Session/Session.php \Symfony\Component\HttpFoundation\Session\Session
- 8 core/lib/Drupal/Core/StackMiddleware/Session.php \Drupal\Core\StackMiddleware\Session
Same name and namespace in other branches
- 8.0 vendor/behat/mink/src/Session.php \Behat\Mink\Session
Mink session.
@author Konstantin Kudryashov <ever.zet@gmail.com>
Hierarchy
- class \Behat\Mink\Session
Expanded class hierarchy of Session
14 files declare their use of Session
- BasePhantomJSDriver.php in vendor/
jcalderonzumba/ mink-phantomjs-driver/ src/ BasePhantomJSDriver.php - BaseUrlTest.php in vendor/
behat/ mink-browserkit-driver/ tests/ Custom/ BaseUrlTest.php - BrowserTestBase.php in core/
modules/ simpletest/ src/ BrowserTestBase.php - Contains \Drupal\simpletest\BrowserTestBase.
- CoreDriver.php in vendor/
behat/ mink/ src/ Driver/ CoreDriver.php - DriverInterface.php in vendor/
behat/ mink/ src/ Driver/ DriverInterface.php
8 string references to 'Session'
- language.schema.yml in core/
modules/ language/ config/ schema/ language.schema.yml - core/modules/language/config/schema/language.schema.yml
- MemcacheSessionTestCase::sessionReset in modules/
memcache/ tests/ memcache-session.test - Reset the cookie file so that it refers to the specified user.
- MemcacheSessionTestCase::testDataPersistence in modules/
memcache/ tests/ memcache-session.test - Test data persistence via the session_test module callbacks. Also tests drupal_session_count() since session data is already generated here.
- MemcacheSessionTestCase::testSessionSaveRegenerate in modules/
memcache/ tests/ memcache-session.test - Tests for drupal_save_session() and drupal_session_regenerate().
- SessionCacheContext::getLabel in core/
lib/ Drupal/ Core/ Cache/ Context/ SessionCacheContext.php
File
- vendor/
behat/ mink/ src/ Session.php, line 22
Namespace
Behat\MinkView source
class Session {
private $driver;
private $page;
private $selectorsHandler;
/**
* Initializes session.
*
* @param DriverInterface $driver
* @param SelectorsHandler $selectorsHandler
*/
public function __construct(DriverInterface $driver, SelectorsHandler $selectorsHandler = null) {
$driver
->setSession($this);
if (null === $selectorsHandler) {
$selectorsHandler = new SelectorsHandler();
}
$this->driver = $driver;
$this->selectorsHandler = $selectorsHandler;
$this->page = new DocumentElement($this);
}
/**
* Checks whether session (driver) was started.
*
* @return Boolean
*/
public function isStarted() {
return $this->driver
->isStarted();
}
/**
* Starts session driver.
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*/
public function start() {
$this->driver
->start();
}
/**
* Stops session driver.
*/
public function stop() {
$this->driver
->stop();
}
/**
* Restart session driver.
*/
public function restart() {
$this->driver
->stop();
$this->driver
->start();
}
/**
* Reset session driver state.
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*/
public function reset() {
$this->driver
->reset();
}
/**
* Returns session driver.
*
* @return DriverInterface
*/
public function getDriver() {
return $this->driver;
}
/**
* Returns page element.
*
* @return DocumentElement
*/
public function getPage() {
return $this->page;
}
/**
* Returns selectors handler.
*
* @return SelectorsHandler
*/
public function getSelectorsHandler() {
return $this->selectorsHandler;
}
/**
* Visit specified URL.
*
* @param string $url url of the page
*/
public function visit($url) {
$this->driver
->visit($url);
}
/**
* Sets HTTP Basic authentication parameters.
*
* @param string|Boolean $user user name or false to disable authentication
* @param string $password password
*/
public function setBasicAuth($user, $password = '') {
$this->driver
->setBasicAuth($user, $password);
}
/**
* Sets specific request header.
*
* @param string $name
* @param string $value
*/
public function setRequestHeader($name, $value) {
$this->driver
->setRequestHeader($name, $value);
}
/**
* Returns all response headers.
*
* @return array
*/
public function getResponseHeaders() {
return $this->driver
->getResponseHeaders();
}
/**
* Returns specific response header.
*
* @param string $name
*
* @return string|null
*/
public function getResponseHeader($name) {
$headers = $this->driver
->getResponseHeaders();
$name = strtolower($name);
$headers = array_change_key_case($headers, CASE_LOWER);
if (!isset($headers[$name])) {
return null;
}
return is_array($headers[$name]) ? $headers[$name][0] : $headers[$name];
}
/**
* Sets cookie.
*
* @param string $name
* @param string $value
*/
public function setCookie($name, $value = null) {
$this->driver
->setCookie($name, $value);
}
/**
* Returns cookie by name.
*
* @param string $name
*
* @return string|null
*/
public function getCookie($name) {
return $this->driver
->getCookie($name);
}
/**
* Returns response status code.
*
* @return int
*/
public function getStatusCode() {
return $this->driver
->getStatusCode();
}
/**
* Returns current URL address.
*
* @return string
*/
public function getCurrentUrl() {
return $this->driver
->getCurrentUrl();
}
/**
* Capture a screenshot of the current window.
*
* @return string screenshot of MIME type image/* depending
* on driver (e.g., image/png, image/jpeg)
*/
public function getScreenshot() {
return $this->driver
->getScreenshot();
}
/**
* Return the names of all open windows.
*
* @return array Array of all open window's names.
*/
public function getWindowNames() {
return $this->driver
->getWindowNames();
}
/**
* Return the name of the currently active window.
*
* @return string The name of the current window.
*/
public function getWindowName() {
return $this->driver
->getWindowName();
}
/**
* Reloads current session page.
*/
public function reload() {
$this->driver
->reload();
}
/**
* Moves backward 1 page in history.
*/
public function back() {
$this->driver
->back();
}
/**
* Moves forward 1 page in history.
*/
public function forward() {
$this->driver
->forward();
}
/**
* Switches to specific browser window.
*
* @param string $name window name (null for switching back to main window)
*/
public function switchToWindow($name = null) {
$this->driver
->switchToWindow($name);
}
/**
* Switches to specific iFrame.
*
* @param string $name iframe name (null for switching back)
*/
public function switchToIFrame($name = null) {
$this->driver
->switchToIFrame($name);
}
/**
* Execute JS in browser.
*
* @param string $script javascript
*/
public function executeScript($script) {
$this->driver
->executeScript($script);
}
/**
* Execute JS in browser and return it's response.
*
* @param string $script javascript
*
* @return string
*/
public function evaluateScript($script) {
return $this->driver
->evaluateScript($script);
}
/**
* Waits some time or until JS condition turns true.
*
* @param int $time time in milliseconds
* @param string $condition JS condition
*
* @return bool
*/
public function wait($time, $condition = 'false') {
return $this->driver
->wait($time, $condition);
}
/**
* Set the dimensions of the window.
*
* @param int $width set the window width, measured in pixels
* @param int $height set the window height, measured in pixels
* @param string $name window name (null for the main window)
*/
public function resizeWindow($width, $height, $name = null) {
$this->driver
->resizeWindow($width, $height, $name);
}
/**
* Maximize the window if it is not maximized already.
*
* @param string $name window name (null for the main window)
*/
public function maximizeWindow($name = null) {
$this->driver
->maximizeWindow($name);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Session:: |
private | property | ||
Session:: |
private | property | ||
Session:: |
private | property | ||
Session:: |
public | function | Moves backward 1 page in history. | |
Session:: |
public | function | Execute JS in browser and return it's response. | |
Session:: |
public | function | Execute JS in browser. | |
Session:: |
public | function | Moves forward 1 page in history. | |
Session:: |
public | function | Returns cookie by name. | |
Session:: |
public | function | Returns current URL address. | |
Session:: |
public | function | Returns session driver. | |
Session:: |
public | function | Returns page element. | |
Session:: |
public | function | Returns specific response header. | |
Session:: |
public | function | Returns all response headers. | |
Session:: |
public | function | Capture a screenshot of the current window. | |
Session:: |
public | function | Returns selectors handler. | |
Session:: |
public | function | Returns response status code. | |
Session:: |
public | function | Return the name of the currently active window. | |
Session:: |
public | function | Return the names of all open windows. | |
Session:: |
public | function | Checks whether session (driver) was started. | |
Session:: |
public | function | Maximize the window if it is not maximized already. | |
Session:: |
public | function | Reloads current session page. | |
Session:: |
public | function | Reset session driver state. | |
Session:: |
public | function | Set the dimensions of the window. | |
Session:: |
public | function | Restart session driver. | |
Session:: |
public | function | Sets HTTP Basic authentication parameters. | |
Session:: |
public | function | Sets cookie. | |
Session:: |
public | function | Sets specific request header. | |
Session:: |
public | function | Starts session driver. | |
Session:: |
public | function | Stops session driver. | |
Session:: |
public | function | Switches to specific iFrame. | |
Session:: |
public | function | Switches to specific browser window. | |
Session:: |
public | function | Visit specified URL. | |
Session:: |
public | function | Waits some time or until JS condition turns true. | |
Session:: |
public | function | Initializes session. |