Пример #1
0
 public function testIsRedirectRedirection()
 {
     foreach (array(301, 302, 303, 307) as $code) {
         $response = new Response('', $code);
         $this->assertTrue($response->isRedirection());
         $this->assertTrue($response->isRedirect());
     }
     $response = new Response('', 304);
     $this->assertTrue($response->isRedirection());
     $this->assertFalse($response->isRedirect());
     $response = new Response('', 200);
     $this->assertFalse($response->isRedirection());
     $this->assertFalse($response->isRedirect());
     $response = new Response('', 404);
     $this->assertFalse($response->isRedirection());
     $this->assertFalse($response->isRedirect());
     $response = new Response('', 301, array('Location' => '/good-uri'));
     $this->assertFalse($response->isRedirect('/bad-uri'));
     $this->assertTrue($response->isRedirect('/good-uri'));
 }