Skip to content

Commit 21a5841

Browse files
author
Michal Piotrowski
committed
RedirectResponse tests
1 parent 2cf50b7 commit 21a5841

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ public function testGenerateMetaRedirect()
2525
));
2626
}
2727

28+
/**
29+
* @expectedException \InvalidArgumentException
30+
*/
31+
public function testRedirectResponseConstructorNullUrl()
32+
{
33+
$response = new RedirectResponse(null);
34+
}
35+
36+
/**
37+
* @expectedException \InvalidArgumentException
38+
*/
39+
public function testRedirectResponseConstructorWrongStatusCode()
40+
{
41+
$response = new RedirectResponse('foo.bar', 404);
42+
}
43+
2844
public function testGenerateLocationHeader()
2945
{
3046
$response = new RedirectResponse('foo.bar');
@@ -48,6 +64,15 @@ public function testSetTargetUrl()
4864
$this->assertEquals('baz.beep', $response->getTargetUrl());
4965
}
5066

67+
/**
68+
* @expectedException \InvalidArgumentException
69+
*/
70+
public function testSetTargetUrlNull()
71+
{
72+
$response = new RedirectResponse('foo.bar');
73+
$response->setTargetUrl(null);
74+
}
75+
5176
public function testCreate()
5277
{
5378
$response = RedirectResponse::create('foo', 301);

0 commit comments

Comments
 (0)