public function testSetCookieCanAppendOtherHeadersInWhenCreatingString() { $setCookieHeader = new Zend_Http_Header_SetCookie(); $setCookieHeader->setName('myname'); $setCookieHeader->setValue('myvalue'); $setCookieHeader->setExpires('Wed, 13-Jan-2021 22:23:01 GMT'); $setCookieHeader->setDomain('docs.foo.com'); $setCookieHeader->setPath('/accounts'); $setCookieHeader->setSecure(true); $setCookieHeader->setHttponly(true); $appendCookie = new Zend_Http_Header_SetCookie('othername', 'othervalue'); $headerLine = $setCookieHeader->toStringMultipleHeaders(array($appendCookie)); $target = 'Set-Cookie: myname=myvalue; Expires=Wed, 13-Jan-2021 22:23:01 GMT;' . ' Domain=docs.foo.com; Path=/accounts;' . ' Secure; HttpOnly, othername=othervalue'; $this->assertEquals($target, $headerLine); }
/** * @group GH-295 */ public function testMultipleCookies() { $setCookieHeader = new Zend_Http_Header_SetCookie('othername1', 'othervalue1'); $appendCookie = new Zend_Http_Header_SetCookie('othername2', 'othervalue2'); $headerLine = $setCookieHeader->toStringMultipleHeaders(array($appendCookie)); $response = new Zend_Controller_Response_HttpTestCase(); $response->setRawHeader($headerLine); $this->assertEquals((array) $headerLine, $response->sendHeaders()); }