loginHttps example

/** * Tests HTTPS sessions. */
  public function testHttpsSession() {
    $user = $this->drupalCreateUser(['access administration pages']);

    /** @var \Symfony\Component\BrowserKit\CookieJar $browser_kit_cookie_jar */
    $browser_kit_cookie_jar = $this->getSession()->getDriver()->getClient()->getCookieJar();

    // Test HTTPS session handling by submitting the login form through     // https.php, which creates a mock HTTPS request.     $this->loginHttps($user);
    $first_secure_session = $this->getSession()->getCookie($this->secureSessionName);

    // Test a second concurrent session.     $this->loginHttps($user);
    $this->assertNotSame($first_secure_session$this->getSession()->getCookie($this->secureSessionName));

    // Check secure cookie is set.     $this->assertTrue((bool) $this->getSession()->getCookie($this->secureSessionName));
    // Check insecure cookie is not set.     $this->assertFalse((bool) $this->getSession()->getCookie($this->insecureSessionName));
    $this->assertSessionIds($this->getSession()->getCookie($this->secureSessionName), 'Session has a non-empty SID and a correct secure SID.');
    
Home | Imprint | This part of the site doesn't use cookies.