/**
* {@inheritdoc}
*/ protectedfunctioninitFrontPage(){ parent::initFrontPage(); // Set a standard window size so that all javascript tests start with the
// same viewport.
$this->getSession()->resizeWindow(1024, 768); }
// Switch browser cookie to anonymous user, then back to user 1.
$session_cookie_name = $this->getSessionName(); $session_cookie_value = $session->getCookie($session_cookie_name); $session->restart(); $this->initFrontPage(); // Session restart always resets all the cookies by design, so we need to
// add the old session cookie again.
$session->setCookie($session_cookie_name, $session_cookie_value); // Verify that the session data persists through browser close.
$this->drupalGet('session-test/get'); $this->assertSession()->pageTextContains($value_1); $this->mink->setDefaultSessionName('default');
// Logout the user and make sure the stored value no longer persists.
$this->drupalLogout(); $this->sessionReset();
// Copies cookies from the current environment, for example, XDEBUG_SESSION
// in order to support Xdebug.
// @see BrowserTestBase::initFrontPage()
$cookies = $this->extractCookiesFromRequest(\Drupal::request()); foreach($cookiesas$cookie_name => $values){ foreach($valuesas$value){ $session->setCookie($cookie_name, $value); } }