示例#1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $application = new Application();
     $application->registerMountProviders();
     // reset backend
     \OC_User::clearBackends();
     \OC_Group::clearBackends();
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     // create users
     $backend = new \Test\Util\User\Dummy();
     \OC_User::useBackend($backend);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER4);
     // create group
     $groupBackend = new \Test\Util\Group\Dummy();
     $groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
     $groupBackend->createGroup('group');
     $groupBackend->createGroup('group1');
     $groupBackend->createGroup('group2');
     $groupBackend->createGroup('group3');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group1');
     $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);
 }
示例#2
0
 public function testGetDeleted()
 {
     $backend = new \Test\Util\Group\Dummy();
     $backend->createGroup('group1');
     /**
      * @var \OC\User\Manager $userManager
      */
     $userManager = $this->getMock('\\OC\\User\\Manager');
     $manager = new \OC\Group\Manager($userManager);
     $manager->addBackend($backend);
     $group = $manager->get('group1');
     $group->delete();
     $this->assertNull($manager->get('group1'));
 }