From 5316d7ade41c5f67298a33c89c6a649079918dc1 Mon Sep 17 00:00:00 2001 From: Daniel Bannert Date: Mon, 19 Sep 2016 20:24:56 +0200 Subject: [PATCH] fixes #384 (#387) * fixes #384 * added code-coverage * change ext --- build/travis/after_success.sh | 2 ++ src/Viserio/Filesystem/FilesystemAdapter.php | 22 +------------------ src/Viserio/Filesystem/FilesystemManager.php | 8 ------- .../Tests/FilesystemManagerTest.php | 12 ---------- src/Viserio/Filesystem/phpunit.xml.dist | 2 +- 5 files changed, 4 insertions(+), 42 deletions(-) diff --git a/build/travis/after_success.sh b/build/travis/after_success.sh index 2f060c945..866691c1c 100644 --- a/build/travis/after_success.sh +++ b/build/travis/after_success.sh @@ -3,4 +3,6 @@ if [[ "$CHECK_CS" = true && "$SEND_COVERAGE" = true ]]; then # Run codecov bash <(curl -s https://codecov.io/bash) + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --access-token="a8a3ec5b2ec383bfeb6c161acd5950fffb54e507a27cf61646e28318285c31c3" --format=php-clover coverage.xml fi diff --git a/src/Viserio/Filesystem/FilesystemAdapter.php b/src/Viserio/Filesystem/FilesystemAdapter.php index 7adb28ffb..3300237fd 100644 --- a/src/Viserio/Filesystem/FilesystemAdapter.php +++ b/src/Viserio/Filesystem/FilesystemAdapter.php @@ -255,26 +255,6 @@ public function getTimestamp(string $path) return ! $getTimestamp ?: $getTimestamp['timestamp']; } - /** - * Set the path for LocalAdapter. - * - * @param string $path - */ - public function setLocalPath(string $path) - { - $this->localPath = $path; - } - - /** - * Get the LocalAdapter path. - * - * @return string - */ - public function getLocalPath(): string - { - return $this->localPath !== '' ? $this->localPath : '/storage/'; - } - /** * {@inheritdoc} * @@ -289,7 +269,7 @@ public function url(string $path): string return $adapter->getClient()->getObjectUrl($adapter->getBucket(), $path); } elseif ($adapter instanceof LocalAdapter) { - return $this->normalizeDirectorySeparator($this->getLocalPath()) . $path; + return $adapter->getPathPrefix() . $path; } elseif (method_exists($adapter, 'getUrl')) { return $adapter->getUrl($path); } diff --git a/src/Viserio/Filesystem/FilesystemManager.php b/src/Viserio/Filesystem/FilesystemManager.php index 8f71fed90..e28e2d48f 100644 --- a/src/Viserio/Filesystem/FilesystemManager.php +++ b/src/Viserio/Filesystem/FilesystemManager.php @@ -112,8 +112,6 @@ protected function getCacheConfig(string $name): array */ protected function adapt(AdapterInterface $adapter, array $config): FilesystemContract { - $localAdapter = $adapter instanceof FlyLocal; - if (isset($config['cache']) && is_array($config['cache'])) { $cacheFactory = new CachedFactory($this, $this->cache); @@ -122,12 +120,6 @@ protected function adapt(AdapterInterface $adapter, array $config): FilesystemCo $filesystemAdapter = new FilesystemAdapter($adapter); - if ($localAdapter) { - $filesystemAdapter->setLocalPath( - $this->config->get($this->getConfigName() . '.disks.local.root', '') - ); - } - return $filesystemAdapter; } diff --git a/src/Viserio/Filesystem/Tests/FilesystemManagerTest.php b/src/Viserio/Filesystem/Tests/FilesystemManagerTest.php index 8de56fd4f..33c55c620 100644 --- a/src/Viserio/Filesystem/Tests/FilesystemManagerTest.php +++ b/src/Viserio/Filesystem/Tests/FilesystemManagerTest.php @@ -127,10 +127,6 @@ public function testLocalConnectorDriver() 'path' => __DIR__, ], ]); - $config->shouldReceive('get') - ->once() - ->with('filesystem.disks.local.root', '') - ->andReturn(''); $manager = new FilesystemManager($config); @@ -220,10 +216,6 @@ public function testVfsConnectorDriver() ->andReturn([ 'vfs' => [], ]); - $config->shouldReceive('get') - ->once() - ->with('filesystem.disks.local.root', '') - ->andReturn(''); $manager = new FilesystemManager($config); @@ -307,10 +299,6 @@ public function testCachedAdapter() 'cache' => 'local', ], ]); - $config->shouldReceive('get') - ->once() - ->with('filesystem.disks.local.root', '') - ->andReturn(''); $config->shouldReceive('get') ->once() ->with('filesystem.cached') diff --git a/src/Viserio/Filesystem/phpunit.xml.dist b/src/Viserio/Filesystem/phpunit.xml.dist index c83871b68..c65e92729 100644 --- a/src/Viserio/Filesystem/phpunit.xml.dist +++ b/src/Viserio/Filesystem/phpunit.xml.dist @@ -22,7 +22,7 @@ - + ./Tests/