function HttpKernelUiHelperTrait::getSession

Same name and namespace in other branches
  1. main core/tests/Drupal/Tests/HttpKernelUiHelperTrait.php \Drupal\Tests\HttpKernelUiHelperTrait::getSession()

Returns Mink session.

The lazily initializes Mink the first time it is called.

Parameters

string $name: (optional) Name of the session. Defaults to the active session.

Return value

\Behat\Mink\Session The active Mink session object.

2 calls to HttpKernelUiHelperTrait::getSession()
HttpKernelUiHelperTrait::assertSession in core/tests/Drupal/Tests/HttpKernelUiHelperTrait.php
Returns WebAssert object.
HttpKernelUiHelperTrait::drupalGet in core/tests/Drupal/Tests/HttpKernelUiHelperTrait.php
Retrieves a Drupal path.

File

core/tests/Drupal/Tests/HttpKernelUiHelperTrait.php, line 111

Class

HttpKernelUiHelperTrait
Provides UI helper methods using the HTTP kernel to make requests.

Namespace

Drupal\Tests

Code

public function getSession($name = NULL) : Session {
  // Lazily initialize the Mink session. We do this because unlike Browser
  // tests where there should definitely be requests made, this is not
  // necessarily the case with Kernel tests.
  if (!isset($this->mink)) {
    $this->initMink();
    // Set up the browser test output file.
    $this->initBrowserOutputFile();
  }
  return $this->mink
    ->getSession($name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.