diff --git a/tests/Middleware/LogExceptionMiddlewareTest.php b/tests/Middleware/LogExceptionMiddlewareTest.php index d7f0c75..75f7ce3 100644 --- a/tests/Middleware/LogExceptionMiddlewareTest.php +++ b/tests/Middleware/LogExceptionMiddlewareTest.php @@ -42,7 +42,7 @@ private function getDependencyContainer(): FactoryContainer { $container->register(OverrideLogServiceModule::class); $container->set( LogExceptionMiddleware::class, - $container ==> new LogExceptionMiddleware($container->get(LoggerInterface::class)), + $container ==> new LogExceptionMiddleware($this->resolveLogger($container)), ); $container->set( FakeThrowExceptionMiddleware::class, @@ -51,4 +51,12 @@ private function getDependencyContainer(): FactoryContainer { $container->lockModule(); return $container; } + + private function resolveLogger(FactoryContainer $container): LoggerInterface { + $instance = $container->get(LoggerInterface::class); + if($instance instanceof LoggerInterface) { + return $instance; + } + return new \Monolog\Logger("Nazg.Log"); + } }