summaryrefslogtreecommitdiffstats
path: root/tests/lib/helperstorage.php
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/helperstorage.php
parent289a27778e78bb69830b5b05f4084627a781157b (diff)
downloadnextcloud-server-6625d5c88f74edade459ec7e2ee0bfb79f21fedd.tar.gz
nextcloud-server-6625d5c88f74edade459ec7e2ee0bfb79f21fedd.zip
Correctly restore previous root mount point after testing
Diffstat (limited to 'tests/lib/helperstorage.php')
-rw-r--r--tests/lib/helperstorage.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/lib/helperstorage.php b/tests/lib/helperstorage.php
index 4fdd9dd6b9b..9f3bd8824f7 100644
--- a/tests/lib/helperstorage.php
+++ b/tests/lib/helperstorage.php
@@ -9,14 +9,22 @@
/**
* Test the storage functions of OC_Helper
*/
-class Test_Helper_Storage extends PHPUnit_Framework_TestCase {
+
+class Test_Helper_Storage extends \Test\TestCase {
+ /** @var string */
private $user;
+ /** @var \OC\Files\Storage\Storage */
private $storageMock;
+ /** @var \OC\Files\Storage\Storage */
+ private $storage;
+
+ protected function setUp() {
+ parent::setUp();
- public function setUp() {
- $this->user = 'user_' . uniqid();
+ $this->user = $this->getUniqueID('user_');
\OC_User::createUser($this->user, $this->user);
+ $this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId($this->user);
\OC\Files\Filesystem::init($this->user, '/' . $this->user . '/files');
@@ -25,7 +33,7 @@ class Test_Helper_Storage extends PHPUnit_Framework_TestCase {
$this->storageMock = null;
}
- public function tearDown() {
+ protected function tearDown() {
$this->user = null;
if ($this->storageMock) {
@@ -33,10 +41,13 @@ class Test_Helper_Storage extends PHPUnit_Framework_TestCase {
$this->storageMock = null;
}
\OC\Files\Filesystem::tearDown();
+ \OC\Files\Filesystem::mount($this->storage, array(), '/');
\OC_User::setUserId('');
\OC_User::deleteUser($this->user);
\OC_Preferences::deleteUser($this->user);
+
+ parent::tearDown();
}
/**