merged branch eventhorizonpl/100ptc_component_httpfundation_p5 (PR #5416)
Commits
-------
21a5841
RedirectResponse tests
Discussion
----------
RedirectResponse tests
Hi,
This patch adds 100% test coverage for RedirectResponse class.
Best regards,
Michal
This commit is contained in:
commit
36c64e0e33
|
@ -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);
|
||||
|
|
Reference in New Issue