summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-08 09:41:25 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-08 09:41:25 +0100
commita1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad (patch)
tree903a6d66cac692bcc68760c87d566faa43b75ea7 /tests
parent88c4cba1f52a63da78da56e50ac9f22a643a5be0 (diff)
parent4e6f6518ff9aec0b838ce0c43a9d3f880b4464ad (diff)
downloadnextcloud-server-a1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad.tar.gz
nextcloud-server-a1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad.zip
Merge pull request #21527 from owncloud/remove_all_avatars
Remove all cache avatars on avatar deletion
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/avatartest.php30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php
index 3d77a282a7d..d3e615977cb 100644
--- a/tests/lib/avatartest.php
+++ b/tests/lib/avatartest.php
@@ -110,13 +110,29 @@ class AvatarTest extends \Test\TestCase {
}
public function testSetAvatar() {
- $oldFile = $this->getMock('\OCP\Files\File');
- $this->folder->method('get')
- ->will($this->returnValueMap([
- ['avatar.jpg', $oldFile],
- ['avatar.png', $oldFile],
- ]));
- $oldFile->expects($this->exactly(2))->method('delete');
+ $avatarFileJPG = $this->getMock('\OCP\Files\File');
+ $avatarFileJPG->method('getName')
+ ->willReturn('avatar.jpg');
+ $avatarFileJPG->expects($this->once())->method('delete');
+
+ $avatarFilePNG = $this->getMock('\OCP\Files\File');
+ $avatarFilePNG->method('getName')
+ ->willReturn('avatar.png');
+ $avatarFilePNG->expects($this->once())->method('delete');
+
+ $resizedAvatarFile = $this->getMock('\OCP\Files\File');
+ $resizedAvatarFile->method('getName')
+ ->willReturn('avatar.32.jpg');
+ $resizedAvatarFile->expects($this->once())->method('delete');
+
+ $nonAvatarFile = $this->getMock('\OCP\Files\File');
+ $nonAvatarFile->method('getName')
+ ->willReturn('avatarX');
+ $nonAvatarFile->expects($this->never())->method('delete');
+
+ $this->folder->method('search')
+ ->with('avatar')
+ ->willReturn([$avatarFileJPG, $avatarFilePNG, $resizedAvatarFile, $nonAvatarFile]);
$newFile = $this->getMock('\OCP\Files\File');
$this->folder->expects($this->once())