示例#1
0
 protected function setUp()
 {
     parent::setUp();
     $this->createUser('userid', 'pass');
     $this->loginAsUser('userid');
     $app = new Application();
     $this->container = $app->getContainer();
     $this->container['AppName'] = 'core';
     $this->container['AvatarManager'] = $this->getMock('OCP\\IAvatarManager');
     $this->container['Cache'] = $this->getMockBuilder('OC\\Cache\\File')->disableOriginalConstructor()->getMock();
     $this->container['L10N'] = $this->getMock('OCP\\IL10N');
     $this->container['L10N']->method('t')->will($this->returnArgument(0));
     $this->container['UserManager'] = $this->getMock('OCP\\IUserManager');
     $this->container['UserSession'] = $this->getMock('OCP\\IUserSession');
     $this->container['Request'] = $this->getMock('OCP\\IRequest');
     $this->container['UserFolder'] = $this->getMock('OCP\\Files\\Folder');
     $this->container['Logger'] = $this->getMock('OCP\\ILogger');
     $this->avatarMock = $this->getMock('OCP\\IAvatar');
     $this->userMock = $this->getMock('OCP\\IUser');
     $this->avatarController = $this->container['AvatarController'];
     // Configure userMock
     $this->userMock->method('getDisplayName')->willReturn('displayName');
     $this->userMock->method('getUID')->willReturn('userId');
     $this->container['UserManager']->method('get')->willReturnMap([['userId', $this->userMock]]);
     $this->container['UserSession']->method('getUser')->willReturn($this->userMock);
     $this->avatarFile = $this->getMock('OCP\\Files\\File');
     $this->avatarFile->method('getContnet')->willReturn('image data');
     $this->avatarFile->method('getMimeType')->willReturn('image type');
     $this->avatarFile->method('getEtag')->willReturn('my etag');
 }
示例#2
0
 protected function setUp()
 {
     $this->shareManager = $this->getMockBuilder('OCP\\Share\\IManager')->disableOriginalConstructor()->getMock();
     $this->groupManager = $this->getMock('OCP\\IGroupManager');
     $this->userManager = $this->getMock('OCP\\IUserManager');
     $this->request = $this->getMock('OCP\\IRequest');
     $this->rootFolder = $this->getMock('OCP\\Files\\IRootFolder');
     $this->urlGenerator = $this->getMock('OCP\\IURLGenerator');
     $this->currentUser = $this->getMock('OCP\\IUser');
     $this->currentUser->method('getUID')->willReturn('currentUser');
     $this->ocs = new Share20OCS($this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser);
 }
示例#3
0
 protected function setUp()
 {
     $this->shareManager = $this->getMockBuilder('OCP\\Share\\IManager')->disableOriginalConstructor()->getMock();
     $this->shareManager->expects($this->any())->method('shareApiEnabled')->willReturn(true);
     $this->groupManager = $this->getMock('OCP\\IGroupManager');
     $this->userManager = $this->getMock('OCP\\IUserManager');
     $this->request = $this->getMock('OCP\\IRequest');
     $this->rootFolder = $this->getMock('OCP\\Files\\IRootFolder');
     $this->urlGenerator = $this->getMock('OCP\\IURLGenerator');
     $this->currentUser = $this->getMock('OCP\\IUser');
     $this->currentUser->method('getUID')->willReturn('currentUser');
     $this->l = $this->getMock('\\OCP\\IL10N');
     $this->l->method('t')->will($this->returnCallback(function ($text, $parameters = []) {
         return vsprintf($text, $parameters);
     }));
     $this->ocs = new Share20OCS($this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser, $this->l);
 }
 public function testMultiBucketConfigFirstFallBackSingle()
 {
     $this->config->expects($this->at(0))->method('getSystemValue')->with($this->equalTo('objectstore_multibucket'))->willReturn('');
     $this->config->expects($this->at(1))->method('getSystemValue')->with($this->equalTo('objectstore'))->willReturn(['class' => 'Test\\Files\\Mount\\FakeObjectStore']);
     $this->user->method('getUID')->willReturn('uid');
     $this->loader->expects($this->never())->method($this->anything());
     $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
     $this->assertInstanceOf('OC\\Files\\Mount\\MountPoint', $mount);
 }