You are here

public function ResponseTest::testIsRedirectRedirection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testIsRedirectRedirection()

File

vendor/symfony/http-foundation/Tests/ResponseTest.php, line 708

Class

ResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

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'));
}