diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-07-02 13:00:21 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-07-02 13:00:21 +0200 |
commit | 079e9cecbaa3c6f68db6f8b685ec41e078c94ff7 (patch) | |
tree | 6a356fff03f7b1004065c278d779dacc62b173eb /apps/files_external/tests | |
parent | bfcb8ffeb3bf46963cb002feec07c08643ec9d82 (diff) | |
download | nextcloud-server-079e9cecbaa3c6f68db6f8b685ec41e078c94ff7.tar.gz nextcloud-server-079e9cecbaa3c6f68db6f8b685ec41e078c94ff7.zip |
Revert "Use OCP classes as much as possible in files_external"
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r-- | apps/files_external/tests/mountconfig.php | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php index f198b09c089..b76ba0a39a6 100644 --- a/apps/files_external/tests/mountconfig.php +++ b/apps/files_external/tests/mountconfig.php @@ -131,9 +131,6 @@ class Test_Mount_Config extends \Test\TestCase { const TEST_GROUP2 = 'group2'; const TEST_GROUP2B = 'group2b'; - private $users = []; - private $groups = []; - protected function setUp() { parent::setUp(); @@ -150,43 +147,32 @@ class Test_Mount_Config extends \Test\TestCase { ) ); - $userManager = \OC::$server->getUserManager(); - $groupManager = \OC::$server->getGroupManager(); - - $this->users[self::TEST_USER1] = $userManager->createUser( - self::TEST_USER1, - self::TEST_USER1 - ); - $this->users[self::TEST_USER2] = $userManager->createUser( - self::TEST_USER2, - self::TEST_USER2 - ); + \OC_User::createUser(self::TEST_USER1, self::TEST_USER1); + \OC_User::createUser(self::TEST_USER2, self::TEST_USER2); - $this->groups[self::TEST_GROUP1] = $groupManager->createGroup(self::TEST_GROUP1); - $this->groups[self::TEST_GROUP1B] = $groupManager->createGroup(self::TEST_GROUP1B); - $this->groups[self::TEST_GROUP2] = $groupManager->createGroup(self::TEST_GROUP2); - $this->groups[self::TEST_GROUP2B] = $groupManager->createGroup(self::TEST_GROUP2B); + \OC_Group::createGroup(self::TEST_GROUP1); + \OC_Group::createGroup(self::TEST_GROUP1B); + \OC_Group::addToGroup(self::TEST_USER1, self::TEST_GROUP1); + \OC_Group::addToGroup(self::TEST_USER1, self::TEST_GROUP1B); + \OC_Group::createGroup(self::TEST_GROUP2); + \OC_Group::createGroup(self::TEST_GROUP2B); + \OC_Group::addToGroup(self::TEST_USER2, self::TEST_GROUP2); + \OC_Group::addToGroup(self::TEST_USER2, self::TEST_GROUP2B); - $this->groups[self::TEST_GROUP1]->addUser($this->users[self::TEST_USER1]); - $this->groups[self::TEST_GROUP1B]->addUser($this->users[self::TEST_USER1]); - $this->groups[self::TEST_GROUP2]->addUser($this->users[self::TEST_USER2]); - $this->groups[self::TEST_GROUP2B]->addUser($this->users[self::TEST_USER2]); - - \OC::$server->getUserSession()->setUser($this->users[self::TEST_USER1]); - $this->userHome = $this->users[self::TEST_USER1]->getHome(); + \OC_User::setUserId(self::TEST_USER1); + $this->userHome = \OC_User::getHome(self::TEST_USER1); @mkdir($this->userHome); - $config = \OC::$server->getConfig(); - $this->dataDir = $config->getSystemValue( + $this->dataDir = \OC_Config::getValue( 'datadirectory', \OC::$SERVERROOT . '/data/' ); - $this->oldAllowedBackends = $config->getAppValue( + $this->oldAllowedBackends = OCP\Config::getAppValue( 'files_external', 'user_mounting_backends', '' ); - $config->setAppValue( + OCP\Config::setAppValue( 'files_external', 'user_mounting_backends', 'Test_Mount_Config_Dummy_Storage' @@ -200,19 +186,16 @@ class Test_Mount_Config extends \Test\TestCase { Test_Mount_Config_Hook_Test::clear(); OC_Mount_Config::$skipTest = false; - foreach ($this->users as $user) { - $user->delete(); - } - foreach ($this->groups as $group) { - $group->delete(); - } - $this->users = []; - $this->groups = []; + \OC_User::deleteUser(self::TEST_USER2); + \OC_User::deleteUser(self::TEST_USER1); + \OC_Group::deleteGroup(self::TEST_GROUP1); + \OC_Group::deleteGroup(self::TEST_GROUP1B); + \OC_Group::deleteGroup(self::TEST_GROUP2); + \OC_Group::deleteGroup(self::TEST_GROUP2B); @unlink($this->dataDir . '/mount.json'); - $config = \OC::$server->getConfig(); - $config->setAppValue( + OCP\Config::setAppValue( 'files_external', 'user_mounting_backends', $this->oldAllowedBackends @@ -795,7 +778,7 @@ class Test_Mount_Config extends \Test\TestCase { ); // check mount points in the perspective of user $testUser - \OC::$server->getUserSession()->setUser($this->users[$testUser]); + \OC_User::setUserId($testUser); $mountPoints = OC_Mount_Config::getAbsoluteMountPoints($testUser); if ($expectVisible) { @@ -1133,7 +1116,7 @@ class Test_Mount_Config extends \Test\TestCase { ); // Ensure other user can read mount points - \OC::$server->getUserSession()->setUser($this->users[self::TEST_USER2]); + \OC_User::setUserId(self::TEST_USER2); $mountPointsMe = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER2); $mountPointsOther = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1); |