From 5be520562997d3898268ed6bb44720ca35e062f1 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 23 Sep 2015 21:22:03 -0400 Subject: Change interface for objectStorage --- app/Controller/File.php | 6 +++--- app/Core/ObjectStorage/FileStorage.php | 2 +- app/Core/ObjectStorage/ObjectStorageInterface.php | 2 +- tests/units/Model/FileTest.php | 10 +++++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Controller/File.php b/app/Controller/File.php index 1431372f..ef90c55a 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -86,7 +86,7 @@ class File extends Base } $this->response->forceDownload($file['name']); - $this->objectStorage->passthru($file['path']); + $this->objectStorage->output($file['path']); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); @@ -128,7 +128,7 @@ class File extends Base } $this->response->contentType($this->file->getImageMimeType($file['name'])); - $this->objectStorage->passthru($file['path']); + $this->objectStorage->output($file['path']); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); @@ -152,7 +152,7 @@ class File extends Base } $this->response->contentType('image/jpeg'); - $this->objectStorage->passthru($this->file->getThumbnailPath($file['path'])); + $this->objectStorage->output($this->file->getThumbnailPath($file['path'])); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); diff --git a/app/Core/ObjectStorage/FileStorage.php b/app/Core/ObjectStorage/FileStorage.php index 96478c3a..fa1efe21 100644 --- a/app/Core/ObjectStorage/FileStorage.php +++ b/app/Core/ObjectStorage/FileStorage.php @@ -70,7 +70,7 @@ class FileStorage implements ObjectStorageInterface * @access public * @param string $key */ - public function passthru($key) + public function output($key) { $filename = $this->path.DIRECTORY_SEPARATOR.$key; diff --git a/app/Core/ObjectStorage/ObjectStorageInterface.php b/app/Core/ObjectStorage/ObjectStorageInterface.php index 5440cf2b..180bdf86 100644 --- a/app/Core/ObjectStorage/ObjectStorageInterface.php +++ b/app/Core/ObjectStorage/ObjectStorageInterface.php @@ -35,7 +35,7 @@ interface ObjectStorageInterface * @access public * @param string $key */ - public function passthru($key); + public function output($key); /** * Move local file to object storage diff --git a/tests/units/Model/FileTest.php b/tests/units/Model/FileTest.php index e7520c89..d1ad7248 100644 --- a/tests/units/Model/FileTest.php +++ b/tests/units/Model/FileTest.php @@ -227,13 +227,21 @@ class FileTest extends Base ->expects($this->at(1)) ->method('remove') ->with( - $this->equalTo('/tmp/foo1') + $this->equalTo('thumbnails//tmp/foo2') ) ->will($this->returnValue(true)); $this->container['objectStorage'] ->expects($this->at(2)) ->method('remove') + ->with( + $this->equalTo('/tmp/foo1') + ) + ->will($this->returnValue(true)); + + $this->container['objectStorage'] + ->expects($this->at(3)) + ->method('remove') ->with( $this->equalTo('/tmp/foo3') ) -- cgit v1.2.3