/** * @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()); }
/** * Check to see if content is NOT matched by regex in selected nodes * * @param Zend_Controller_Response_HttpTestCase $response * @param string $pattern * @return bool */ protected function _notRegex($response, $pattern) { if (!$response->isRedirect()) { return true; } $headers = $response->sendHeaders(); $redirect = $headers['location']; $redirect = str_replace('Location: ', '', $redirect); return !preg_match($pattern, $redirect); }
/** * @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()); }