Permalink
Browse files

RedirectResponse tests

  • Loading branch information...
eventhorizonpl committed Sep 1, 2012
1 parent 2cf50b7 commit 21a5841c6a46f281ebe505898d26b5a96ba9d9e6
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
@@ -25,6 +25,22 @@ public function testGenerateMetaRedirect()
));
}
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testRedirectResponseConstructorNullUrl()
+ {
+ $response = new RedirectResponse(null);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testRedirectResponseConstructorWrongStatusCode()
+ {
+ $response = new RedirectResponse('foo.bar', 404);
+ }
+
public function testGenerateLocationHeader()
{
$response = new RedirectResponse('foo.bar');
@@ -48,6 +64,15 @@ public function testSetTargetUrl()
$this->assertEquals('baz.beep', $response->getTargetUrl());
}
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testSetTargetUrlNull()
+ {
+ $response = new RedirectResponse('foo.bar');
+ $response->setTargetUrl(null);
+ }
+
public function testCreate()
{
$response = RedirectResponse::create('foo', 301);

0 comments on commit 21a5841

Please sign in to comment.