diff --git a/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php b/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php index dcee4f8..ed3f6e8 100644 --- a/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php +++ b/core/modules/system/src/Tests/Session/SessionAuthenticationTest.php @@ -125,23 +125,13 @@ public function testBasicAuthNoSession() { // sustaining the session. $this->basicAuthGet($no_cookie_url, $this->user->getUsername(), $this->user->pass_raw); $this->assertResponse(200, 'The user is successfully authenticated using basic authentication.'); - $this->assertEqual($this->getSetCookieCount(), 0, 'No cookie is set on a route protected with basic authentication.'); + $this->assertFalse($this->drupalGetHeader('set-cookie', TRUE), 'No cookie is set on a route protected with basic authentication.'); // On the other hand, authenticating using Cookie sets a cookie. $edit = ['name' => $this->user->getUsername(), 'pass' => $this->user->pass_raw]; $this->drupalPostForm($cookie_url, $edit, t('Log in')); $this->assertResponse(200, 'The user is successfully authenticated using cookie authentication.'); - $this->assertEqual($this->getSetCookieCount(), 1, 'A cookie is set on a route protected with cookie authentication.'); - } - - /** - * Returns the number of cookies that were set in the last request. - * - * @return int - * The number of cookies that were set. - */ - protected function getSetCookieCount() { - return count(preg_grep('/^Set-Cookie: ([^=]+)=(.+)/', $this->headers)); + $this->assertTrue($this->drupalGetHeader('set-cookie', TRUE), 'A cookie is set on a route protected with cookie authentication.'); } }