initFrontPage example


    if ($this->disableCssAnimations) {
      self::$modules[] = 'css_disable_transitions_test';
    }
    parent::installModulesFromClassProperty($container);
  }

  /** * {@inheritdoc} */
  protected function initFrontPage() {
    parent::initFrontPage();
    // Set a standard window size so that all javascript tests start with the     // same viewport.     $this->getSession()->resizeWindow(1024, 768);
  }

  /** * {@inheritdoc} */
  protected function tearDown(): void {
    if ($this->mink) {
      $status = $this->getStatus();
      
    $this->drupalGet('session-test/no-set/' . $value_2);
    $session = $this->getSession();
    $this->assertSession()->pageTextContains($value_2);
    // Verify that the session data is not saved for drupal_save_session(FALSE).     $this->drupalGet('session-test/get');
    $this->assertSession()->pageTextContains($value_1);

    // 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();
    


    $selectors_handler = new SelectorsHandler([
      'hidden_field_selector' => new HiddenFieldSelector(),
    ]);
    $session = new Session($driver$selectors_handler);
    $this->mink = new Mink();
    $this->mink->registerSession('default', $session);
    $this->mink->setDefaultSessionName('default');
    $this->registerSessions();

    $this->initFrontPage();

    // Copies cookies from the current environment, for example, XDEBUG_SESSION     // in order to support Xdebug.     // @see BrowserTestBase::initFrontPage()     $cookies = $this->extractCookiesFromRequest(\Drupal::request());
    foreach ($cookies as $cookie_name => $values) {
      foreach ($values as $value) {
        $session->setCookie($cookie_name$value);
      }
    }

    
Home | Imprint | This part of the site doesn't use cookies.