]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix quota wrapper
authorRobin Appelman <icewind@owncloud.com>
Wed, 2 Dec 2015 14:28:49 +0000 (15:28 +0100)
committerRobin Appelman <icewind@owncloud.com>
Thu, 14 Jan 2016 11:54:42 +0000 (12:54 +0100)
lib/private/files/storage/wrapper/quota.php
tests/lib/files/storage/wrapper/quota.php

index 55c826092c1b295ef3de0c168072312c4ef8ca29..844505679df0f4bc3076929dc207d967da30ddbf 100644 (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;
index 95bc2ff7a1a96871b2888f13e6fdef802e4f66ef..d087a3eef3340d91d79a16f3449e84d979e9e3f3 100644 (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'));