示例#1
0
 public function testRebuild()
 {
     $expectedContent = ['foo' => 'bar'];
     $expectedHeaders = new \Phalcon\Http\Response\Headers();
     $expectedHeaders->set('Status', '200 OK');
     $expectedHeaders->set('HTTP/1.1 200 OK', null);
     $this->response->rebuild(['foo' => 'bar']);
     $this->assertEquals($expectedContent, $this->response->getContent());
     $this->assertEquals($expectedHeaders, $this->response->getHeaders());
 }
示例#2
0
 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());
 }
示例#3
0
 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());
 }