renamed some confusing tests

This commit is contained in:
Fabien Potencier 2015-04-11 08:34:27 +02:00
parent 9215c222ff
commit a8e4c43080
1 changed files with 18 additions and 4 deletions

View File

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