RedirectResponse tests

This commit is contained in:
Michal Piotrowski 2012-09-01 08:25:20 -04:00
parent 2cf50b7801
commit 21a5841c6a
1 changed files with 25 additions and 0 deletions

View File

@ -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);