diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-04-08 12:03:55 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-04-08 12:45:38 +0200 |
commit | f8cfc03f36e438f1874e9840ce69811112e15475 (patch) | |
tree | 4b09a8e57c2c1492ee023e2adf9efa2a9acc709e /tests/lib/files/node | |
parent | 6c327f8331617652ef0b268d51edc6a23624e33c (diff) | |
download | nextcloud-server-f8cfc03f36e438f1874e9840ce69811112e15475.tar.gz nextcloud-server-f8cfc03f36e438f1874e9840ce69811112e15475.zip |
Replace originalStorage in tests with a proper teardown
The purpose of $originalStorage in unit tests was to remount the old
root.
However that storage itself is already wrapped by storage wrapper, so
remounting it would rewrap the storage several times.
This fix makes use of "loginAsUser()" and "logout()" from the TestCase
class to properly initialize and cleanup the FS as expected.
Diffstat (limited to 'tests/lib/files/node')
-rw-r--r-- | tests/lib/files/node/integration.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/integration.php index 456a4a0e287..4e362607240 100644 --- a/tests/lib/files/node/integration.php +++ b/tests/lib/files/node/integration.php @@ -20,9 +20,6 @@ class IntegrationTests extends \Test\TestCase { */ private $root; - /** @var \OC\Files\Storage\Storage */ - private $originalStorage; - /** * @var \OC\Files\Storage\Storage[] */ @@ -36,9 +33,6 @@ class IntegrationTests extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->originalStorage = \OC\Files\Filesystem::getStorage('/'); - \OC\Files\Filesystem::init('', ''); - \OC\Files\Filesystem::clearMounts(); $manager = \OC\Files\Filesystem::getMountManager(); \OC_Hook::clear('OC_Filesystem'); @@ -49,7 +43,8 @@ class IntegrationTests extends \Test\TestCase { \OC_Hook::connect('OC_Filesystem', 'post_touch', '\OC\Files\Cache\Updater', 'touchHook'); $user = new User($this->getUniqueID('user'), new \OC_User_Dummy); - \OC_User::setUserId($user->getUID()); + $this->loginAsUser($user->getUID()); + $this->view = new View(); $this->root = new Root($manager, $this->view, $user); $storage = new Temporary(array()); @@ -64,9 +59,8 @@ class IntegrationTests extends \Test\TestCase { foreach ($this->storages as $storage) { $storage->getCache()->clear(); } - \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($this->originalStorage, array(), '/'); + $this->logout(); parent::tearDown(); } |