renamed some confusing tests
This commit is contained in:
parent
9215c222ff
commit
a8e4c43080
|
@ -26,7 +26,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
|
||||
{
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
|
||||
|
||||
|
@ -36,14 +36,14 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalseAndNoListenerIsRegistered()
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
|
||||
{
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
|
||||
|
||||
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
|
||||
}
|
||||
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
|
||||
|
@ -51,12 +51,26 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
|
|||
});
|
||||
|
||||
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
|
||||
$response = $kernel->handle(new Request());
|
||||
$response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
|
||||
|
||||
$this->assertEquals('500', $response->getStatusCode());
|
||||
$this->assertEquals('foo', $response->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
|
||||
// should set a response, but does not
|
||||
});
|
||||
|
||||
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
|
||||
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
|
||||
}
|
||||
|
||||
public function testHandleExceptionWithARedirectionResponse()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
|
|
Reference in New Issue