summaryrefslogtreecommitdiffstats
path: root/tests/lib/cache
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-12 15:54:41 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-17 10:48:19 +0100
commit6625d5c88f74edade459ec7e2ee0bfb79f21fedd (patch)
treec615a82f5838b8ebded306c4c474751d2f2e782a /tests/lib/cache
parent289a27778e78bb69830b5b05f4084627a781157b (diff)
downloadnextcloud-server-6625d5c88f74edade459ec7e2ee0bfb79f21fedd.tar.gz
nextcloud-server-6625d5c88f74edade459ec7e2ee0bfb79f21fedd.zip
Correctly restore previous root mount point after testing
Diffstat (limited to 'tests/lib/cache')
-rw-r--r--tests/lib/cache/file.php11
-rw-r--r--tests/lib/cache/usercache.php12
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php
index 0e19c105cd1..8cc45c85405 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/file.php
@@ -23,8 +23,12 @@
namespace Test\Cache;
class FileCache extends \Test_Cache {
+ /** @var string */
private $user;
+ /** @var string */
private $datadir;
+ /** @var \OC\Files\Storage\Storage */
+ private $storage;
function skip() {
//$this->skipUnless(OC_User::isLoggedIn());
@@ -42,6 +46,7 @@ class FileCache extends \Test_Cache {
//}
//set up temporary storage
+ $this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::clearMounts();
$storage = new \OC\Files\Storage\Temporary(array());
\OC\Files\Filesystem::mount($storage,array(),'/');
@@ -68,5 +73,11 @@ class FileCache extends \Test_Cache {
public function tearDown() {
\OC_User::setUserId($this->user);
\OC_Config::setValue('cachedirectory', $this->datadir);
+
+ // Restore the original mount point
+ \OC\Files\Filesystem::clearMounts();
+ \OC\Files\Filesystem::mount($this->storage, array(), '/');
+
+ parent::tearDown();
}
}
diff --git a/tests/lib/cache/usercache.php b/tests/lib/cache/usercache.php
index a1b6af1c55d..8a23a805ebe 100644
--- a/tests/lib/cache/usercache.php
+++ b/tests/lib/cache/usercache.php
@@ -23,8 +23,12 @@
namespace Test\Cache;
class UserCache extends \Test_Cache {
+ /** @var string */
private $user;
+ /** @var string */
private $datadir;
+ /** @var \OC\Files\Storage\Storage */
+ private $storage;
public function setUp() {
//clear all proxies and hooks so we can do clean testing
@@ -38,6 +42,7 @@ class UserCache extends \Test_Cache {
//}
//set up temporary storage
+ $this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::clearMounts();
$storage = new \OC\Files\Storage\Temporary(array());
\OC\Files\Filesystem::mount($storage,array(),'/');
@@ -63,5 +68,12 @@ class UserCache extends \Test_Cache {
public function tearDown() {
\OC_User::setUserId($this->user);
+ \OC_Config::setValue('cachedirectory', $this->datadir);
+
+ // Restore the original mount point
+ \OC\Files\Filesystem::clearMounts();
+ \OC\Files\Filesystem::mount($this->storage, array(), '/');
+
+ parent::tearDown();
}
}