Fix mock call in AvatarControllerTest

This commit is contained in:
Roeland Jago Douma 2016-08-15 20:07:07 +02:00
parent 5e9c7d3ff3
commit b860fa7125
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 12 additions and 12 deletions

View File

@ -68,19 +68,19 @@ class AvatarControllerTest extends \Test\TestCase {
$app = new Application; $app = new Application;
$this->container = $app->getContainer(); $this->container = $app->getContainer();
$this->container['AppName'] = 'core'; $this->container['AppName'] = 'core';
$this->container['AvatarManager'] = $this->getMock('OCP\IAvatarManager'); $this->container['AvatarManager'] = $this->getMockBuilder('OCP\IAvatarManager')->getMock();
$this->container['Cache'] = $this->getMockBuilder('OC\Cache\File') $this->container['Cache'] = $this->getMockBuilder('OC\Cache\File')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->container['L10N'] = $this->getMock('OCP\IL10N'); $this->container['L10N'] = $this->getMockBuilder('OCP\IL10N')->getMock();
$this->container['L10N']->method('t')->will($this->returnArgument(0)); $this->container['L10N']->method('t')->will($this->returnArgument(0));
$this->container['UserManager'] = $this->getMock('OCP\IUserManager'); $this->container['UserManager'] = $this->getMockBuilder('OCP\IUserManager')->getMock();
$this->container['UserSession'] = $this->getMock('OCP\IUserSession'); $this->container['UserSession'] = $this->getMockBuilder('OCP\IUserSession')->getMock();
$this->container['Request'] = $this->getMock('OCP\IRequest'); $this->container['Request'] = $this->getMockBuilder('OCP\IRequest')->getMock();
$this->container['UserFolder'] = $this->getMock('OCP\Files\Folder'); $this->container['UserFolder'] = $this->getMockBuilder('OCP\Files\Folder')->getMock();
$this->container['Logger'] = $this->getMock('OCP\ILogger'); $this->container['Logger'] = $this->getMockBuilder('OCP\ILogger')->getMock();
$this->avatarMock = $this->getMock('OCP\IAvatar'); $this->avatarMock = $this->getMockBuilder('OCP\IAvatar')->getMock();
$this->userMock = $this->getMock('OCP\IUser'); $this->userMock = $this->getMockBuilder('OCP\IUser')->getMock();
$this->avatarController = $this->container['AvatarController']; $this->avatarController = $this->container['AvatarController'];
@ -91,7 +91,7 @@ class AvatarControllerTest extends \Test\TestCase {
->willReturnMap([['userId', $this->userMock]]); ->willReturnMap([['userId', $this->userMock]]);
$this->container['UserSession']->method('getUser')->willReturn($this->userMock); $this->container['UserSession']->method('getUser')->willReturn($this->userMock);
$this->avatarFile = $this->getMock('OCP\Files\File'); $this->avatarFile = $this->getMockBuilder('OCP\Files\File')->getMock();
$this->avatarFile->method('getContent')->willReturn('image data'); $this->avatarFile->method('getContent')->willReturn('image data');
$this->avatarFile->method('getMimeType')->willReturn('image type'); $this->avatarFile->method('getMimeType')->willReturn('image type');
$this->avatarFile->method('getEtag')->willReturn('my etag'); $this->avatarFile->method('getEtag')->willReturn('my etag');
@ -326,7 +326,7 @@ class AvatarControllerTest extends \Test\TestCase {
* Test posting avatar from existing folder * Test posting avatar from existing folder
*/ */
public function testPostAvatarFromNoFile() { public function testPostAvatarFromNoFile() {
$file = $this->getMock('OCP\Files\Node'); $file = $this->getMockBuilder('OCP\Files\Node')->getMock();
$this->container['UserFolder'] $this->container['UserFolder']
->method('get') ->method('get')
->with('folder') ->with('folder')