From f8cfc03f36e438f1874e9840ce69811112e15475 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 8 Apr 2015 12:03:55 +0200 Subject: 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. --- tests/lib/files/node/integration.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tests/lib/files/node') 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(); } -- cgit v1.2.3