Beispiel #1
0
 public function testGetAvatarValidUser()
 {
     $this->userManager->expects($this->once())->method('get')->with('validUser')->willReturn(true);
     $folder = $this->getMock('\\OCP\\Files\\Folder');
     $this->rootFolder->expects($this->once())->method('getUserFolder')->with('validUser')->willReturn($folder);
     $folder->expects($this->once())->method('getParent')->will($this->returnSelf());
     $this->avatarManager->getAvatar('validUser');
 }
Beispiel #2
0
 public function testCreateShareGroup()
 {
     $share = $this->getMock('\\OC\\Share20\\IShare');
     $this->shareManager->method('newShare')->willReturn($share);
     $ocs = $this->getMockBuilder('OCA\\Files_Sharing\\API\\Share20OCS')->setConstructorArgs([$this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser])->setMethods(['formatShare'])->getMock();
     $this->request->method('getParam')->will($this->returnValueMap([['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], ['shareType', '-1', \OCP\Share::SHARE_TYPE_GROUP], ['shareWith', null, 'validGroup']]));
     $userFolder = $this->getMock('\\OCP\\Files\\Folder');
     $this->rootFolder->expects($this->once())->method('getUserFolder')->with('currentUser')->willReturn($userFolder);
     $path = $this->getMock('\\OCP\\Files\\Folder');
     $userFolder->expects($this->once())->method('get')->with('valid-path')->willReturn($path);
     $group = $this->getMock('\\OCP\\IGroup');
     $this->groupManager->method('groupExists')->with('validGroup')->willReturn(true);
     $this->groupManager->method('get')->with('validGroup')->willReturn($group);
     $share->method('setPath')->with($path);
     $share->method('setPermissions')->with(\OCP\Constants::PERMISSION_ALL);
     $share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_GROUP);
     $share->method('setSharedWith')->with($group);
     $share->method('setSharedBy')->with($this->currentUser);
     $expected = new \OC_OCS_Result();
     $result = $ocs->createShare();
     $this->assertEquals($expected->getMeta(), $result->getMeta());
     $this->assertEquals($expected->getData(), $result->getData());
 }