public static function __set_state($data) { return parent::__set_state($data); }
/** * Tests setCache * * @author Sid Roberts <*****@*****.**> * @since 2015-07-14 */ public function testHttpResponseSetCache() { $this->specify("setCache is not producing the correct results", function () { $response = $this->getResponseObject(); $expiry = new \DateTime(); $expiry->setTimezone(new \DateTimeZone("UTC")); $expiry->modify("+60 minutes"); $response->setCache(60); $expected = Headers::__set_state(['_headers' => ["Expires" => $expiry->format("D, d M Y H:i:s") . " GMT", "Cache-Control" => "max-age=3600"]]); expect($response->getHeaders())->equals($expected); }); }
/** * Tests redirect remotely 301 * * @author Nikolaos Dimopoulos <*****@*****.**> * @since 2014-10-08 */ public function testHttpResponseRedirectRemoteLUrl301() { $this->specify("redirect is not redirecting remote 301 properly", function () { $response = $this->getResponseObject(); $response->resetHeaders(); $response->redirect("http://google.com", true, 301); $actual = $response->getHeaders(); $expected = PhResponseHeaders::__set_state(['_headers' => ['Status' => '301 Moved Permanently', 'Location' => 'http://google.com', 'HTTP/1.1 301 Moved Permanently' => null]]); expect($actual)->equals($expected); }); }
public function testRedirect() { //local URI $this->_response->resetHeaders(); $this->_response->redirect("some/local/uri"); $this->assertEquals(\Phalcon\Http\Response\Headers::__set_state(array('_headers' => array('HTTP/1.1 302 Found' => false, 'Status' => '302 Found', 'Location' => '/some/local/uri'))), $this->_response->getHeaders()); //Full URL $this->_response->resetHeaders(); $this->_response->redirect("http://google.com", true); $this->assertEquals(\Phalcon\Http\Response\Headers::__set_state(array('_headers' => array('HTTP/1.1 302 Found' => false, 'Status' => '302 Found', 'Location' => 'http://google.com'))), $this->_response->getHeaders()); //HTTP code $this->_response->resetHeaders(); $this->_response->redirect("http://google.com", true, 301); $this->assertEquals(\Phalcon\Http\Response\Headers::__set_state(array('_headers' => array('HTTP/1.1 301 Moved Permanently' => false, 'Status' => '301 Moved Permanently', 'Location' => 'http://google.com'))), $this->_response->getHeaders()); }