aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-12-16 20:26:00 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2015-12-16 20:29:02 +0100
commitd796c43841f5f22e39af76e2c11d60335e985738 (patch)
treee3ea078843b5e20230f546d782ef61e67b331e3f /tests/lib
parent1d932e4c98d7a08d9e34e85112b77dc76ca65482 (diff)
downloadnextcloud-server-d796c43841f5f22e39af76e2c11d60335e985738.tar.gz
nextcloud-server-d796c43841f5f22e39af76e2c11d60335e985738.zip
[Avatars] Add function to get the Node of the avatar
Since we usually just get the avatar and stream the content to the users there is no need to first create an image in memory.
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/avatartest.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php
index 49e8be98c83..3d77a282a7d 100644
--- a/tests/lib/avatartest.php
+++ b/tests/lib/avatartest.php
@@ -60,12 +60,25 @@ class AvatarTest extends \Test\TestCase {
$file = $this->getMock('\OCP\Files\File');
$file->method('getContent')->willReturn($expected->data());
- $this->folder->method('get')->with('avatar.png')->willReturn($file);
+
+ $this->folder->method('get')
+ ->will($this->returnCallback(
+ function($path) use ($file) {
+ if ($path === 'avatar.png') {
+ return $file;
+ } else {
+ throw new \OCP\Files\NotFoundException;
+ }
+ }
+ ));
$newFile = $this->getMock('\OCP\Files\File');
$newFile->expects($this->once())
->method('putContent')
->with($expected2->data());
+ $newFile->expects($this->once())
+ ->method('getContent')
+ ->willReturn($expected2->data());
$this->folder->expects($this->once())
->method('newFile')
->with('avatar.32.png')