public function ResponseTest::testIsInvalid

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php, line 348

Class

ResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testIsInvalid() {
  $response = new Response();
  try {
    $response
      ->setStatusCode(99);
    $this
      ->fail();
  } catch (\InvalidArgumentException $e) {
    $this
      ->assertTrue($response
      ->isInvalid());
  }
  try {
    $response
      ->setStatusCode(650);
    $this
      ->fail();
  } catch (\InvalidArgumentException $e) {
    $this
      ->assertTrue($response
      ->isInvalid());
  }
  $response = new Response('', 200);
  $this
    ->assertFalse($response
    ->isInvalid());
}