fix quota wrapper

This commit is contained in:
Robin Appelman 2015-12-02 15:28:49 +01:00
parent 62d383e1ba
commit d2c579e167
2 changed files with 6 additions and 2 deletions

View File

@ -25,6 +25,8 @@
namespace OC\Files\Storage\Wrapper;
use OCP\Files\Cache\ICacheEntry;
class Quota extends Wrapper {
/**
@ -64,7 +66,7 @@ class Quota extends Wrapper {
$cache = $storage->getCache();
}
$data = $cache->get($path);
if (is_array($data) and isset($data['size'])) {
if ($data instanceof ICacheEntry and isset($data['size'])) {
return $data['size'];
} else {
return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;

View File

@ -9,6 +9,8 @@
namespace Test\Files\Storage\Wrapper;
//ensure the constants are loaded
use OC\Files\Cache\CacheEntry;
\OC::$loader->load('\OC\Files\Filesystem');
/**
@ -194,7 +196,7 @@ class Quota extends \Test\Files\Storage\Storage {
$cache->expects($this->once())
->method('get')
->with('files')
->will($this->returnValue(array('size' => 50)));
->will($this->returnValue(new CacheEntry(['size' => 50])));
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files'));