Add unit test for FileStorage

This commit is contained in:
Frederic Guillot
2015-10-03 15:55:20 -04:00
parent aeab662d65
commit d7c0fabcb7
3 changed files with 312 additions and 4 deletions

View File

@@ -53,7 +53,6 @@ class FileStorage implements ObjectStorageInterface
* @access public
* @param string $key
* @param string $blob
* @return string
*/
public function put($key, &$blob)
{
@@ -78,7 +77,7 @@ class FileStorage implements ObjectStorageInterface
throw new ObjectStorageException('File not found: '.$filename);
}
return readfile($filename);
readfile($filename);
}
/**
@@ -141,7 +140,7 @@ class FileStorage implements ObjectStorageInterface
*/
private function createFolder($key)
{
$folder = $this->path.DIRECTORY_SEPARATOR.dirname($key);
$folder = strpos($key, '/') !== false ? $this->path.DIRECTORY_SEPARATOR.dirname($key) : $this->path;
if (! is_dir($folder) && ! mkdir($folder, 0755, true)) {
throw new ObjectStorageException('Unable to create folder: '.$folder);

View File

@@ -25,7 +25,6 @@ interface ObjectStorageInterface
* @access public
* @param string $key
* @param string $blob
* @return string
*/
public function put($key, &$blob);