Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ytake committed Jan 9, 2018
1 parent a6062f0 commit a3e751a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/Middleware/LogExceptionMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
}
}

0 comments on commit a3e751a

Please sign in to comment.