diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 1b52ae1..84322c2 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -262,12 +262,14 @@ class RouterTest extends TestCase { $this->router->map('GET /api/intune/hey', [$this, 'ok']); + $error_description = 'error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the'; + $error_description .= '+app.%0d%0aTrace+ID%3a+747c0cc1-ccbd-4e53-8e2f-48812eb24100%0d%0a'; + $error_description .= 'Correlation+ID%3a+362e3cb3-20ef-400b-904e-9983bd989184%0d%0a'; + $error_description .= 'Timestamp%3a+2022-09-08+09%3a58%3a12Z'; + $query_params = [ 'error=access_denied', - 'error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the' - . '+app.%0d%0aTrace+ID%3a+747c0cc1-ccbd-4e53-8e2f-48812eb24100%0d%0a' - . 'Correlation+ID%3a+362e3cb3-20ef-400b-904e-9983bd989184%0d%0a' - . 'Timestamp%3a+2022-09-08+09%3a58%3a12Z', + $error_description, 'error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d65004', 'admin_consent=True', 'state=x2EUE0fcSj#' diff --git a/tests/server/index.php b/tests/server/index.php index b3d5230..c13e359 100644 --- a/tests/server/index.php +++ b/tests/server/index.php @@ -9,7 +9,9 @@ declare(strict_types=1); * @author Kristaps Muižnieks https://github.com/krmu */ - require file_exists(__DIR__ . '/../../vendor/autoload.php') ? __DIR__ . '/../../vendor/autoload.php' : __DIR__ . '/../../flight/autoload.php'; +require_once file_exists(__DIR__ . '/../../vendor/autoload.php') + ? __DIR__ . '/../../vendor/autoload.php' + : __DIR__ . '/../../flight/autoload.php'; Flight::set('flight.content_length', false); Flight::set('flight.views.path', './'); @@ -95,17 +97,23 @@ Flight::group('', function () { Flight::route('/error', function () { trigger_error('This is a successful error'); }); -}, [ new LayoutMiddleware() ]); +}, [new LayoutMiddleware()]); Flight::map('error', function (Throwable $e) { + $styles = join(';', [ + 'border: 2px solid red', + 'padding: 21px', + 'background: lightgray', + 'font-weight: bold' + ]); + echo sprintf( - '
%s', + "
%s", $e->getMessage(), $e->getCode(), str_replace(getenv('PWD'), '***CONFIDENTIAL***', $e->getTraceAsString()) ); + echo "