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. --- apps/files/tests/ajax_rename.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'apps/files') diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php index 789177bb353..34e7f5085dd 100644 --- a/apps/files/tests/ajax_rename.php +++ b/apps/files/tests/ajax_rename.php @@ -38,21 +38,15 @@ class Test_OC_Files_App_Rename extends \Test\TestCase { */ private $files; - private $originalStorage; - protected function setUp() { parent::setUp(); - $this->originalStorage = \OC\Files\Filesystem::getStorage('/'); - // mock OC_L10n if (!self::$user) { self::$user = uniqid(); } \OC_User::createUser(self::$user, 'password'); - \OC_User::setUserId(self::$user); - - \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files'); + $this->loginAsUser(self::$user); $l10nMock = $this->getMock('\OC_L10N', array('t'), array(), '', false); $l10nMock->expects($this->any()) @@ -72,9 +66,8 @@ class Test_OC_Files_App_Rename extends \Test\TestCase { protected function tearDown() { $result = \OC_User::deleteUser(self::$user); $this->assertTrue($result); - \OC\Files\Filesystem::tearDown(); - \OC\Files\Filesystem::mount($this->originalStorage, array(), '/'); + $this->logout(); parent::tearDown(); } -- cgit v1.2.3