Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-12-16 22:26:00 +0300
committerRoeland Jago Douma <rullzer@owncloud.com>2015-12-16 22:29:02 +0300
commitd796c43841f5f22e39af76e2c11d60335e985738 (patch)
treee3ea078843b5e20230f546d782ef61e67b331e3f /tests
parent1d932e4c98d7a08d9e34e85112b77dc76ca65482 (diff)
[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')
-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')