Ejemplo n.º 1
0
 /**
  * Tests Handling a PHP7 error
  *
  * @return void
  */
 public function testHandlePHP7Error()
 {
     $this->skipIf(!class_exists('Error'), 'Requires PHP7');
     $error = new PHP7ErrorException(new ParseError('Unexpected variable foo'));
     $errorHandler = new TestErrorHandler();
     $errorHandler->handleException($error);
     $this->assertContains('Unexpected variable foo', $errorHandler->response->body(), 'message missing.');
 }
Ejemplo n.º 2
0
 /**
  * tests it is possible to load a plugin exception renderer
  *
  * @return void
  */
 public function testLoadPluginHandler()
 {
     Plugin::load('TestPlugin');
     $errorHandler = new TestErrorHandler(['exceptionRenderer' => 'TestPlugin.TestPluginExceptionRenderer']);
     $error = new NotFoundException('Kaboom!');
     $errorHandler->handleException($error);
     $result = $errorHandler->response;
     $this->assertEquals('Rendered by test plugin', $result);
 }