aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Avatars
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-16 15:37:47 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-16 15:37:47 +0100
commit8614eb91db754eec7904841e44fbbbc63ffb013a (patch)
treee62f285708fbf5488b8cde55fb31631bd21b5984 /apps/dav/tests/unit/Avatars
parent48ea7251d74302993bbd1a86d7c01b45417c1965 (diff)
downloadnextcloud-server-8614eb91db754eec7904841e44fbbbc63ffb013a.tar.gz
nextcloud-server-8614eb91db754eec7904841e44fbbbc63ffb013a.zip
Fix avatarHome
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav/tests/unit/Avatars')
-rw-r--r--apps/dav/tests/unit/Avatars/AvatarHomeTest.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php
index aa5c4bf3049..2dffa8b7424 100644
--- a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php
+++ b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php
@@ -86,11 +86,10 @@ class AvatarHomeTest extends TestCase {
if ($expectedException !== null) {
$this->expectException($expectedException);
}
- $avatar = null;
- if ($hasAvatar) {
- $avatar = $this->createMock(IAvatar::class);
- $avatar->expects($this->once())->method('exists')->willReturn(true);
- }
+
+ $avatar = $this->createMock(IAvatar::class);
+ $avatar->method('exists')->willReturn($hasAvatar);
+
$this->avatarManager->expects($this->any())->method('getAvatar')->with('admin')->willReturn($avatar);
$avatarNode = $this->home->getChild($path);
$this->assertInstanceOf(AvatarNode::class, $avatarNode);
@@ -111,11 +110,9 @@ class AvatarHomeTest extends TestCase {
* @dataProvider providesTestGetChild
*/
public function testChildExists($expectedException, $hasAvatar, $path) {
- $avatar = null;
- if ($hasAvatar) {
- $avatar = $this->createMock(IAvatar::class);
- $avatar->expects($this->once())->method('exists')->willReturn(true);
- }
+ $avatar = $this->createMock(IAvatar::class);
+ $avatar->method('exists')->willReturn($hasAvatar);
+
$this->avatarManager->expects($this->any())->method('getAvatar')->with('admin')->willReturn($avatar);
$childExists = $this->home->childExists($path);
$this->assertEquals($hasAvatar, $childExists);