diff options
Diffstat (limited to 'tests/lib/files/view.php')
-rw-r--r-- | tests/lib/files/view.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 931f5acd95a..f42308318d5 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -22,9 +22,15 @@ class View extends \PHPUnit_Framework_TestCase { private $storages = array(); private $user; + /** @var \OC\Files\Storage\Storage */ private $tempStorage; - public function setUp() { + /** @var \OC\Files\Storage\Storage */ + private $originalStorage; + + protected function setUp() { + parent::setUp(); + \OC_User::clearBackends(); \OC_User::useBackend(new \OC_User_Dummy()); @@ -33,12 +39,13 @@ class View extends \PHPUnit_Framework_TestCase { $this->user = \OC_User::getUser(); \OC_User::setUserId('test'); + $this->originalStorage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); $this->tempStorage = null; } - public function tearDown() { + protected function tearDown() { \OC_User::setUserId($this->user); foreach ($this->storages as $storage) { $cache = $storage->getCache(); @@ -49,6 +56,11 @@ class View extends \PHPUnit_Framework_TestCase { if ($this->tempStorage && !\OC_Util::runningOnWindows()) { system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir())); } + + \OC\Files\Filesystem::clearMounts(); + \OC\Files\Filesystem::mount($this->originalStorage, array(), '/'); + + parent::tearDown(); } /** |