Contao\CoreBundle\Test\EventListener\PrettyErrorScreenListenerTest::testContaoPageHandler PHP Method

testContaoPageHandler() public method

Tests rendering the Contao page handler.
public testContaoPageHandler ( integer $type, Exception $exception )
$type integer
$exception Exception
    public function testContaoPageHandler($type, \Exception $exception)
    {
        $GLOBALS['TL_PTY']['error_' . $type] = 'Contao\\PageError' . $type;
        $event = new GetResponseForExceptionEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, $exception);
        $this->listener->onKernelException($event);
        $this->assertTrue($event->hasResponse());
        $response = $event->getResponse();
        $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
        $this->assertEquals($type, $response->getStatusCode());
        unset($GLOBALS['TL_PTY']);
    }