8000 renamed some confusing tests · symfony/symfony@a8e4c43 · GitHub
[go: up one dir, main page]

Skip to content

Commit a8e4c43

Browse files
committed
renamed some confusing tests
1 parent 9215c22 commit a8e4c43

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
2626
/**
2727
* @expectedException \RuntimeException
2828
*/
29-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
29+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
3030
{
3131
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
3232

@@ -36,27 +36,41 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
3636
/**
3737
* @expectedException \RuntimeException
3838
*/
39-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalseAndNoListenerIsRegistered()
39+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
4040
{
4141
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
4242

4343
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
4444
}
4545

46-
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
46+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener()
4747
{
4848
$dispatcher = new EventDispatcher();
4949
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
5050
$event->setResponse(new Response($event->getException()->getMessage()));
5151
});
5252

5353
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
54-
$response = $kernel->handle(new Request());
54+
$response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
5555

5656
$this->assertEquals('500', $response->getStatusCode());
5757
$this->assertEquals('foo', $response->getContent());
5858
}
5959

60+
/**
61+
* @expectedException \RuntimeException
62+
*/
63+
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener()
64+
{
65+
$dispatcher = new EventDispatcher();
66+
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
67+
// should set a response, but does not
68+
});
69+
70+
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
71+
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
72+
}
73+
6074
public function testHandleExceptionWithARedirectionResponse()
6175
{
6276
$dispatcher = new EventDispatcher();

0 commit comments

Comments
 (0)
0