From 21a5841c6a46f281ebe505898d26b5a96ba9d9e6 Mon Sep 17 00:00:00 2001 From: Michal Piotrowski Date: Sat, 1 Sep 2012 08:25:20 -0400 Subject: [PATCH] RedirectResponse tests --- .../Tests/RedirectResponseTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php index b55c3b63d7..330d9fee51 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php @@ -25,6 +25,22 @@ class RedirectResponseTest extends \PHPUnit_Framework_TestCase )); } + /** + * @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 @@ class RedirectResponseTest extends \PHPUnit_Framework_TestCase $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);