/** * @dataProvider validCookieWithInfoProvider */ public function testAddingAsRawHeaderToResponseObject($cStr, $info, $expected) { $response = new Zend_Controller_Response_HttpTestCase(); $cookie = Zend_Http_Header_SetCookie::fromString($cStr); $response->setRawHeader($cookie); $this->assertContains((string) $cookie, $response->sendHeaders()); }
/** * @return array */ public function htmlResponseProvider() { $data = array(); $response1 = new Zend_Controller_Response_HttpTestCase(); $response1->setHeader('Content-Type', 'text/html'); $data[] = array($response1, true, 'Content-Type: text/html'); $response2 = new Zend_Controller_Response_HttpTestCase(); $response2->setHeader('Content-Type', 'text/xml'); $data[] = array($response2, false, 'Content-Type: text/xml'); $response3 = new Zend_Controller_Response_HttpTestCase(); $response3->setRawHeader('Content-Type: text/html'); $data[] = array($response3, true, 'Content-Type: text/html'); $response4 = new Zend_Controller_Response_HttpTestCase(); $response4->setRawHeader('Content-Type: text/html; charset=utf-8'); $data[] = array($response4, true, 'Content-Type: text/html; charset=utf-8'); $response5 = new Zend_Controller_Response_HttpTestCase(); $response5->setHeader('Content-Type', 'text/html; charset=utf-8'); $data[] = array($response5, true, 'Content-Type: text/html; charset=utf-8'); $response6 = new Zend_Controller_Response_HttpTestCase(); $response6->setRawHeader('ConTent-type: TEXT/HTML; charset=utf-8'); $data[] = array($response6, true, 'ConTent-type: TEXT/HTML; charset=utf-8'); $response7 = new Zend_Controller_Response_HttpTestCase(); $response7->setRawHeader('Content-Type: text/xml'); $data[] = array($response7, false, 'Content-Type: text/xml'); return $data; }
/** * @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()); }