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()); }
public function testIssue1182() { $this->_response->resetHeaders(); $this->_response->redirect("http://google.com", false, 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()); }