public function test_convert_error_to_exception_and_call_handler_and_handle_exception()
 {
     $converter = new ErrorConverter();
     $handler = new ErrorHandler(true);
     $handler->addExceptionHandler(function (ErrorException $ex) {
         return true;
     });
     $error = new RecoverableError(ErrorType::ERROR, 'foo', 'bar', 'yolo');
     $converter->convertErrorToExceptionAndCallHandler($handler, $error);
 }
<?php

use Weew\ErrorHandler\ErrorHandler;
use Weew\ErrorHandler\ErrorType;
use Weew\ErrorHandler\Exceptions\UserErrorException;
require __DIR__ . '/../../../../vendor/autoload.php';
$errorHandler = new ErrorHandler(true);
$errorHandler->enableFatalErrorHandling();
$errorHandler->enableExceptionHandling();
$errorHandler->addExceptionHandler(function (UserErrorException $ex) {
    echo 'handled fatal converted';
    return true;
});
trigger_error('error', ErrorType::USER_ERROR);
 public function test_exception_from_exception_handler_is_handled()
 {
     $handler = new ErrorHandler();
     $exception = new Exception();
     $handler->addExceptionHandler(function (Exception $ex) {
         throw new Exception();
     });
     try {
         $handler->handleException($exception);
     } catch (Exception $ex) {
     }
 }
<?php

use Tests\Weew\ErrorHandler\Stubs\FooException;
use Weew\ErrorHandler\ErrorHandler;
require __DIR__ . '/../../../../vendor/autoload.php';
$errorHandler = new ErrorHandler();
$errorHandler->enableExceptionHandling();
$errorHandler->addExceptionHandler(function (FooException $ex) {
    echo 'handled exception';
    return true;
});
throw new FooException();