]> source.dussan.org Git - nextcloud-server.git/commitdiff
Assert that User::triggerChange is called upon avatar change
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 22 Jan 2016 11:56:53 +0000 (12:56 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 25 Jan 2016 19:05:11 +0000 (20:05 +0100)
tests/lib/avatartest.php

index 2e7ec00428f2eadb258e1fa4a8f3b3b616f0db44..264ce163e274e342fe3e8579b1738a92bc8fbb0f 100644 (file)
@@ -16,6 +16,9 @@ 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();
 
@@ -23,9 +26,8 @@ class AvatarTest extends \Test\TestCase {
                /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject $l */
                $l = $this->getMock('\OCP\IL10N');
                $l->method('t')->will($this->returnArgument(0));
-               /** @var \OC\User\User | PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock();
-               $this->avatar = new \OC\Avatar($this->folder, $l, $user);
+               $this->user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock();
+               $this->avatar = new \OC\Avatar($this->folder, $l, $this->user);
        }
 
        public function testGetNoAvatar() {
@@ -161,6 +163,8 @@ class AvatarTest extends \Test\TestCase {
                        ->method('putContent')
                        ->with($image->data());
 
+               $this->user->expects($this->once())->method('triggerChange');
+
                $this->avatar->set($image->data());
        }