diff options
author | Joas Schilling <coding@schilljs.com> | 2018-08-01 14:46:44 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-08-01 14:46:44 +0200 |
commit | 38fffffe18dc705f29bbb477aebd8497f173d37a (patch) | |
tree | e721da34dd90ca75e3d3ae0756f137bd1e43b6d1 | |
parent | decd1961627986db094de4bf9b83589b9ccdb41e (diff) | |
download | nextcloud-server-38fffffe18dc705f29bbb477aebd8497f173d37a.tar.gz nextcloud-server-38fffffe18dc705f29bbb477aebd8497f173d37a.zip |
Fix unit test
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | tests/Core/Controller/AvatarControllerTest.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 3194d671908..3369fa882c8 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -34,7 +34,7 @@ namespace Tests\Core\Controller; use OC\AppFramework\Utility\TimeFactory; use OC\Core\Controller\AvatarController; use OCP\AppFramework\Http; -use OCP\Files\Cache\ICache; +use OCP\ICache; use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; @@ -143,6 +143,9 @@ class AvatarControllerTest extends \Test\TestCase { public function testGetAvatar() { $this->avatarMock->method('getFile')->willReturn($this->avatarFile); $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); + $this->avatarMock->expects($this->once()) + ->method('isCustomAvatar') + ->willReturn(true); $response = $this->avatarController->getAvatar('userId', 32); @@ -154,6 +157,22 @@ class AvatarControllerTest extends \Test\TestCase { } /** + * Fetch the user's avatar + */ + public function testGetGeneratedAvatar() { + $this->avatarMock->method('getFile')->willReturn($this->avatarFile); + $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); + + $response = $this->avatarController->getAvatar('userId', 32); + + $this->assertEquals(Http::STATUS_CREATED, $response->getStatus()); + $this->assertArrayHasKey('Content-Type', $response->getHeaders()); + $this->assertEquals('image type', $response->getHeaders()['Content-Type']); + + $this->assertEquals('my etag', $response->getETag()); + } + + /** * Fetch the avatar of a non-existing user */ public function testGetAvatarNoUser() { |