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/filesystem.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'tests/lib/files/filesystem.php') diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php index 7bf59315d77..98e96e0cc78 100644 --- a/tests/lib/files/filesystem.php +++ b/tests/lib/files/filesystem.php @@ -28,9 +28,6 @@ class Filesystem extends \Test\TestCase { */ private $tmpDirs = array(); - /** @var \OC\Files\Storage\Storage */ - private $originalStorage; - /** * @return array */ @@ -42,20 +39,15 @@ class Filesystem extends \Test\TestCase { protected function setUp() { parent::setUp(); - - $this->originalStorage = \OC\Files\Filesystem::getStorage('/'); - \OC_User::setUserId(''); - \OC\Files\Filesystem::clearMounts(); + $this->loginAsUser(); } protected function tearDown() { foreach ($this->tmpDirs as $dir) { \OC_Helper::rmdirr($dir); } - \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($this->originalStorage, array(), '/'); - \OC_User::setUserId(''); + $this->logout(); parent::tearDown(); } -- cgit v1.2.3