diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-18 20:27:43 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-20 14:57:20 +0100 |
commit | aeb89947a2bddb1db10426538afaccdc141c059e (patch) | |
tree | 4cd9bada02f0c7d4c944d5b83160f2d8e2bf831b /tests/settings | |
parent | dd733d89256e0a2d1f7f4f96ac46b5a7bfbff984 (diff) | |
download | nextcloud-server-aeb89947a2bddb1db10426538afaccdc141c059e.tar.gz nextcloud-server-aeb89947a2bddb1db10426538afaccdc141c059e.zip |
Introduce IUser::setEMailAddress and add hook mechanism
Diffstat (limited to 'tests/settings')
-rw-r--r-- | tests/settings/controller/userscontrollertest.php | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/tests/settings/controller/userscontrollertest.php b/tests/settings/controller/userscontrollertest.php index e1e3c4d4b6b..38fc1ee6102 100644 --- a/tests/settings/controller/userscontrollertest.php +++ b/tests/settings/controller/userscontrollertest.php @@ -1679,11 +1679,11 @@ class UsersControllerTest extends \Test\TestCase { */ public function setEmailAddressData() { return [ - /* mailAddress, isValid, expectsUpdate, expectsDelete, canChangeDisplayName, responseCode */ - [ '', true, false, true, true, Http::STATUS_OK ], - [ 'foo@local', true, true, false, true, Http::STATUS_OK], - [ 'foo@bar@local', false, false, false, true, Http::STATUS_UNPROCESSABLE_ENTITY], - [ 'foo@local', true, false, false, false, Http::STATUS_FORBIDDEN], + /* mailAddress, isValid, expectsUpdate, canChangeDisplayName, responseCode */ + [ '', true, true, true, Http::STATUS_OK ], + [ 'foo@local', true, true, true, Http::STATUS_OK], + [ 'foo@bar@local', false, false, true, Http::STATUS_UNPROCESSABLE_ENTITY], + [ 'foo@local', true, false, false, Http::STATUS_FORBIDDEN], ]; } @@ -1695,7 +1695,7 @@ class UsersControllerTest extends \Test\TestCase { * @param bool $expectsUpdate * @param bool $expectsDelete */ - public function testSetEmailAddress($mailAddress, $isValid, $expectsUpdate, $expectsDelete, $canChangeDisplayName, $responseCode) { + public function testSetEmailAddress($mailAddress, $isValid, $expectsUpdate, $canChangeDisplayName, $responseCode) { $this->container['IsAdmin'] = true; $user = $this->getMockBuilder('\OC\User\User') @@ -1708,6 +1708,13 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->any()) ->method('canChangeDisplayName') ->will($this->returnValue($canChangeDisplayName)); + $user + ->expects($expectsUpdate ? $this->once() : $this->never()) + ->method('setEMailAddress') + ->with( + $this->equalTo($mailAddress) + ); + $this->container['UserSession'] ->expects($this->atLeastOnce()) ->method('getUser') @@ -1730,26 +1737,6 @@ class UsersControllerTest extends \Test\TestCase { ->will($this->returnValue($user)); } - $this->container['Config'] - ->expects(($expectsUpdate) ? $this->once() : $this->never()) - ->method('setUserValue') - ->with( - $this->equalTo($user->getUID()), - $this->equalTo('settings'), - $this->equalTo('email'), - $this->equalTo($mailAddress) - - ); - $this->container['Config'] - ->expects(($expectsDelete) ? $this->once() : $this->never()) - ->method('deleteUserValue') - ->with( - $this->equalTo($user->getUID()), - $this->equalTo('settings'), - $this->equalTo('email') - - ); - $response = $this->container['UsersController']->setMailAddress($user->getUID(), $mailAddress); $this->assertSame($responseCode, $response->getStatus()); |