diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-26 11:37:17 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-26 11:37:17 +0100 |
commit | 528546066973658445d6fd0fe22814e0a062fdca (patch) | |
tree | b4e9ba80b704f1fd43b2977246bc42c2eadedb26 /tests | |
parent | 2bafb1c6493d67360f9ac6f4997a56664f3f2751 (diff) | |
parent | a1ca9de0f56a5f490880bf94be6f0bddf8610bdb (diff) | |
download | nextcloud-server-528546066973658445d6fd0fe22814e0a062fdca.tar.gz nextcloud-server-528546066973658445d6fd0fe22814e0a062fdca.zip |
Merge pull request #21845 from owncloud/sync-system-addressbook-on-avatar-change
Changing the avatar of the user emits the changeUser event which trig…
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/avatarmanagertest.php | 2 | ||||
-rw-r--r-- | tests/lib/avatartest.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/lib/avatarmanagertest.php b/tests/lib/avatarmanagertest.php index 40d07bb49ae..cb9068c46a6 100644 --- a/tests/lib/avatarmanagertest.php +++ b/tests/lib/avatarmanagertest.php @@ -55,7 +55,7 @@ class AvatarManagerTest extends \Test\TestCase { public function testGetAvatarValidUser() { $this->userManager->expects($this->once()) - ->method('userExists') + ->method('get') ->with('validUser') ->willReturn(true); diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php index fe6d3e2fa3f..e7d78311085 100644 --- a/tests/lib/avatartest.php +++ b/tests/lib/avatartest.php @@ -16,13 +16,18 @@ class AvatarTest extends \Test\TestCase { /** @var \OC\Avatar */ private $avatar; + /** @var \OC\User\User | PHPUnit_Framework_MockObject_MockObject $user */ + private $user; + public function setUp() { parent::setUp(); $this->folder = $this->getMock('\OCP\Files\Folder'); + /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject $l */ $l = $this->getMock('\OCP\IL10N'); $l->method('t')->will($this->returnArgument(0)); - $this->avatar = new \OC\Avatar($this->folder, $l); + $this->user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock(); + $this->avatar = new \OC\Avatar($this->folder, $l, $this->user); } public function testGetNoAvatar() { @@ -158,6 +163,9 @@ class AvatarTest extends \Test\TestCase { ->method('putContent') ->with($image->data()); + // One on remove and once on setting the new avatar + $this->user->expects($this->exactly(2))->method('triggerChange'); + $this->avatar->set($image->data()); } |