diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-03-03 01:24:27 -0600 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-03-09 17:35:09 -0600 |
commit | a5ba1f78033b3ebe69c771fb33c1217a60494728 (patch) | |
tree | b4bdf0ec562db9e91071eeef39f82586ce48eef4 /apps/files_sharing | |
parent | 6fd0e7e93995facfe75b26699ea462bb94fd03b9 (diff) | |
download | nextcloud-server-a5ba1f78033b3ebe69c771fb33c1217a60494728.tar.gz nextcloud-server-a5ba1f78033b3ebe69c771fb33c1217a60494728.zip |
Remove legacy class OC_Group and OC_User
* basically a straight replacement of the wrapped code at the calling code parts
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/tests/TestCase.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index a9163a086bf..3b1ccb71a94 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -75,7 +75,7 @@ abstract class TestCase extends \Test\TestCase { // reset backend \OC_User::clearBackends(); - \OC_Group::clearBackends(); + \OC::$server->getGroupManager()->clearBackends(); // clear share hooks \OC_Hook::clear('OCP\\Share'); @@ -103,7 +103,7 @@ abstract class TestCase extends \Test\TestCase { $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group2'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER4, 'group3'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1); - \OC_Group::useBackend($groupBackend); + \OC::$server->getGroupManager()->addBackend($groupBackend); } protected function setUp() { @@ -136,7 +136,10 @@ abstract class TestCase extends \Test\TestCase { if ($user !== null) { $user->delete(); } // delete group - \OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1); + $group = \OC::$server->getGroupManager()->get(self::TEST_FILES_SHARING_API_GROUP1); + if ($group) { + $group->delete(); + } \OC_Util::tearDownFS(); \OC_User::setUserId(''); @@ -145,8 +148,8 @@ abstract class TestCase extends \Test\TestCase { // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); - \OC_Group::clearBackends(); - \OC_Group::useBackend(new \OC\Group\Database()); + \OC::$server->getGroupManager()->clearBackends(); + \OC::$server->getGroupManager()->addBackend(new \OC\Group\Database()); parent::tearDownAfterClass(); } @@ -163,9 +166,15 @@ abstract class TestCase extends \Test\TestCase { } if ($create) { - \OC::$server->getUserManager()->createUser($user, $password); - \OC_Group::createGroup('group'); - \OC_Group::addToGroup($user, 'group'); + $userManager = \OC::$server->getUserManager(); + $groupManager = \OC::$server->getGroupManager(); + + $userObject = $userManager->createUser($user, $password); + $group = $groupManager->createGroup('group'); + + if ($group and $userObject) { + $group->addUser($userObject); + } } self::resetStorage(); |