public function testHttpCookieCreateFromRawSetCookieResponseHeaderWithHttpOnlyEnabled() { $cookieHeader = 'cookieName=value; Expires=asdfasdf; Version=1; Domain=test.local; Path=/; Secure; HttpOnly'; // init cookie by raw header $cookie = HttpCookie::createFromRawSetCookieHeader($cookieHeader); $this->assertSame(true, $cookie->isHttpOnly()); }
/** * Parses the http set cookie header * * @param string $headerValue The header value with cookie info in it * * @return void */ public function parseCookieHeaderValue($headerValue) { $request = $this->getRequest(); // parse cookies and iterate over foreach (explode(';', $headerValue) as $cookieStr) { // check if cookieStr is no just a empty str if (strlen($cookieStr) > 0) { // add cookie object to request $request->addCookie(HttpCookie::createFromRawSetCookieHeader($cookieStr)); } } }