diff --git a/src/Console/ClearCacheCommand.php b/src/Console/ClearCacheCommand.php index d8d648b..03d3328 100644 --- a/src/Console/ClearCacheCommand.php +++ b/src/Console/ClearCacheCommand.php @@ -56,10 +56,7 @@ public function fire() $driverConfig = $configure['aop'][$configure['default']]; if (isset($driverConfig['cacheDir'])) { - $compileCaches = $this->filesystem->glob($driverConfig['cacheDir'] . '/*'); - foreach ($compileCaches as $file) { - $this->filesystem->deleteDirectory($file); - } + $this->filesystem->cleanDirectory($driverConfig['cacheDir']); } $this->info('aspect/annotation cache clear!'); } diff --git a/tests/CacheableTest.php b/tests/CacheableTest.php index 05c7b64..42e6335 100644 --- a/tests/CacheableTest.php +++ b/tests/CacheableTest.php @@ -77,7 +77,6 @@ protected function resolveManager() { $annotation = new \Ytake\LaravelAspect\Annotation; $annotation->registerAspectAnnotations(); - /** @var \Ytake\LaravelAop\GoAspect $aspect */ $aspect = $this->manager->driver('go'); $aspect->register(); } diff --git a/tests/Commands/AspectClearCacheCommandTest.php b/tests/Commands/AspectClearCacheCommandTest.php index 109e6c0..c49050b 100644 --- a/tests/Commands/AspectClearCacheCommandTest.php +++ b/tests/Commands/AspectClearCacheCommandTest.php @@ -39,7 +39,8 @@ public function testCacheClearFile() $configure = $this->app['config']->get('ytake-laravel-aop'); $driverConfig = $configure['aop'][$configure['default']]; if(isset($driverConfig['cacheDir'])) { - $this->assertFalse($this->app['filesystem']->exists($driverConfig['cacheDir'])); + $files = $this->app['filesystem']->files($driverConfig['cacheDir']); + $this->assertCount(0, $files); } }