コード例 #1
0
ファイル: ViewTest.php プロジェクト: rchicoli/owncloud-core
 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear();
     \OC_User::clearBackends();
     \OC_User::useBackend(new \Test\Util\User\Dummy());
     //login
     $userManager = \OC::$server->getUserManager();
     $groupManager = \OC::$server->getGroupManager();
     $this->user = '******';
     $this->userObject = $userManager->createUser('test', 'test');
     $this->groupObject = $groupManager->createGroup('group1');
     $this->groupObject->addUser($this->userObject);
     $this->loginAsUser($this->user);
     // clear mounts but somehow keep the root storage
     // that was initialized above...
     \OC\Files\Filesystem::clearMounts();
     $this->tempStorage = null;
 }
コード例 #2
0
 public function testPropagateWhenRemovedFromGroupWithSubdirTarget()
 {
     $this->recipientGroup->addUser($this->recipientUser);
     // relogin to refresh mount points
     $this->loginAsUser($this->recipientUser->getUID());
     $recipientView = new View('/' . $this->recipientUser->getUID() . '/files');
     $this->assertTrue($recipientView->mkdir('sub'));
     $this->assertTrue($recipientView->rename('folder', 'sub/folder'));
     $this->propagationManager->expects($this->once())->method('propagateSharesToUser')->with($this->callback(function ($shares) {
         if (count($shares) !== 1) {
             return false;
         }
         $share = array_values($shares)[0];
         return $share['file_source'] === $this->fileInfo['fileid'] && $share['share_with'] === $this->recipientGroup->getGID() && $share['file_target'] === '/sub/folder';
     }), $this->recipientUser->getUID());
     $this->recipientGroup->removeUser($this->recipientUser);
 }