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'); }