From: Thomas Müller Date: Fri, 22 Jan 2016 11:56:53 +0000 (+0100) Subject: Assert that User::triggerChange is called upon avatar change X-Git-Tag: v9.0beta1~195^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=68ef6e1bdd88458259c499e7b0729a7ab92546e8;p=nextcloud-server.git Assert that User::triggerChange is called upon avatar change --- diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php index 2e7ec00428f..264ce163e27 100644 --- a/tests/lib/avatartest.php +++ b/tests/lib/avatartest.php @@ -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()); }