diff --git a/src/Caching/MemcachedServiceProvider.php b/src/Caching/MemcachedServiceProvider.php index 15a8e5f..91cb984 100644 --- a/src/Caching/MemcachedServiceProvider.php +++ b/src/Caching/MemcachedServiceProvider.php @@ -109,7 +109,7 @@ public function register(Container $app) */ private function getLogger(Container $app, $name) { - if (!isset($app[$name.'.enable_log']) || !interface_exists('Psr\Log\LoggerInterface')) { + if (!isset($app[$name.'.enable_log']) || true !== $app[$name.'.enable_log'] || !interface_exists('Psr\Log\LoggerInterface')) { return null; } diff --git a/tests/Caching/Tests/MemcachedServiceProviderTest.php b/tests/Caching/Tests/MemcachedServiceProviderTest.php index bc6923c..e253b65 100644 --- a/tests/Caching/Tests/MemcachedServiceProviderTest.php +++ b/tests/Caching/Tests/MemcachedServiceProviderTest.php @@ -165,15 +165,24 @@ public function provideLoggerByConfiguration() return [ // add logger to $app['logger'] before testing [true, false, ['memcache.client' => 'mock']], - [true, true, ['memcache.client' => 'mock', 'memcache.enable_log' => false]], + [true, false, ['memcache.client' => 'mock', 'memcache.enable_log' => false]], [true, true, ['memcache.client' => 'mock', 'memcache.enable_log' => true]], [true, false, ['test.client' => 'mock', 'test.logger' => new TestLogger()], 'test'], // do not add logger to $app['logger'] before testing [false, false, ['memcache.client' => 'mock', 'memcache.logger' => new TestLogger()]], [ - false, true, + true, + [ + 'memcache.client' => 'mock', + 'memcache.enable_log' => true, + 'memcache.logger' => new TestLogger(), + ], + ], + [ + false, + false, [ 'memcache.client' => 'mock', 'memcache.enable_log' => false, @@ -190,15 +199,6 @@ public function provideLoggerByConfiguration() ], 'test', ], - [ - true, - true, - [ - 'memcache.client' => 'mock', - 'memcache.enable_log' => true, - 'memcache.logger' => new TestLogger(), - ], - ], [ false, false,