diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-01 12:05:40 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-02 21:25:05 +0100 |
commit | eebe2b9c239a7f9e7e127f52ab4b9e97763b0149 (patch) | |
tree | 81d9d855b7b6e0d5fb387cd5e8c6092f17e21de3 /tests/settings | |
parent | df5872ec50a68de5d99bd6b5cf17ceb94f2ef833 (diff) | |
download | nextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.tar.gz nextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.zip |
User IUser::getEMailAddress() all over the place
Diffstat (limited to 'tests/settings')
-rw-r--r-- | tests/settings/controller/userscontrollertest.php | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/tests/settings/controller/userscontrollertest.php b/tests/settings/controller/userscontrollertest.php index b10737035ea..b52d6c66aad 100644 --- a/tests/settings/controller/userscontrollertest.php +++ b/tests/settings/controller/userscontrollertest.php @@ -14,6 +14,8 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; /** + * @group DB + * * @package OC\Settings\Controller */ class UsersControllerTest extends \Test\TestCase { @@ -60,7 +62,7 @@ class UsersControllerTest extends \Test\TestCase { $foo = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $foo - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('foo')); $foo @@ -68,6 +70,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('M. Foo')); $foo + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('foo@bar.com')); + $foo ->method('getLastLogin') ->will($this->returnValue(500)); $foo @@ -80,7 +86,7 @@ class UsersControllerTest extends \Test\TestCase { $admin = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $admin - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('admin')); $admin @@ -89,6 +95,10 @@ class UsersControllerTest extends \Test\TestCase { ->will($this->returnValue('S. Admin')); $admin ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('admin@bar.com')); + $admin + ->expects($this->once()) ->method('getLastLogin') ->will($this->returnValue(12)); $admin @@ -102,7 +112,7 @@ class UsersControllerTest extends \Test\TestCase { $bar = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $bar - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('bar')); $bar @@ -110,6 +120,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('B. Ar')); $bar + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('bar@dummy.com')); + $bar ->method('getLastLogin') ->will($this->returnValue(3999)); $bar @@ -145,11 +159,11 @@ class UsersControllerTest extends \Test\TestCase { ->with('bar') ->will($this->returnValue($bar)); $this->container['Config'] - ->expects($this->exactly(6)) + ->expects($this->exactly(3)) ->method('getUserValue') - ->will($this->onConsecutiveCalls(1024, 'foo@bar.com', - 404, 'admin@bar.com', - 2323, 'bar@dummy.com')); + ->will($this->onConsecutiveCalls(1024, + 404, + 2323)); $subadmin = $this->getMockBuilder('\OC\SubAdmin') ->disableOriginalConstructor() @@ -232,7 +246,7 @@ class UsersControllerTest extends \Test\TestCase { $foo = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $foo - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('foo')); $foo @@ -240,6 +254,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('M. Foo')); $foo + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('foo@bar.com')); + $foo ->method('getLastLogin') ->will($this->returnValue(500)); $foo @@ -252,7 +270,7 @@ class UsersControllerTest extends \Test\TestCase { $admin = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $admin - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('admin')); $admin @@ -261,6 +279,10 @@ class UsersControllerTest extends \Test\TestCase { ->will($this->returnValue('S. Admin')); $admin ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('admin@bar.com')); + $admin + ->expects($this->once()) ->method('getLastLogin') ->will($this->returnValue(12)); $admin @@ -274,7 +296,7 @@ class UsersControllerTest extends \Test\TestCase { $bar = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $bar - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('bar')); $bar @@ -282,6 +304,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('B. Ar')); $bar + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('bar@dummy.com')); + $bar ->method('getLastLogin') ->will($this->returnValue(3999)); $bar @@ -326,12 +352,12 @@ class UsersControllerTest extends \Test\TestCase { ->with('admin') ->will($this->returnValue($admin)); $this->container['Config'] - ->expects($this->exactly(6)) + ->expects($this->exactly(3)) ->method('getUserValue') ->will($this->onConsecutiveCalls( - 2323, 'bar@dummy.com', - 1024, 'foo@bar.com', - 404, 'admin@bar.com' + 2323, + 1024, + 404 )); $subgroup1 = $this->getMockBuilder('\OCP\IGroup') @@ -417,7 +443,7 @@ class UsersControllerTest extends \Test\TestCase { $foo = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $foo - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('foo')); $foo @@ -425,6 +451,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('M. Foo')); $foo + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('foo@bar.com')); + $foo ->method('getLastLogin') ->will($this->returnValue(500)); $foo @@ -437,7 +467,7 @@ class UsersControllerTest extends \Test\TestCase { $admin = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $admin - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('admin')); $admin @@ -446,6 +476,10 @@ class UsersControllerTest extends \Test\TestCase { ->will($this->returnValue('S. Admin')); $admin ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('admin@bar.com')); + $admin + ->expects($this->once()) ->method('getLastLogin') ->will($this->returnValue(12)); $admin @@ -459,7 +493,7 @@ class UsersControllerTest extends \Test\TestCase { $bar = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $bar - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('bar')); $bar @@ -467,6 +501,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('B. Ar')); $bar + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue('bar@dummy.com')); + $bar ->method('getLastLogin') ->will($this->returnValue(3999)); $bar @@ -487,11 +525,9 @@ class UsersControllerTest extends \Test\TestCase { ->method('getUserGroupIds') ->will($this->onConsecutiveCalls(array('Users', 'Support'), array('admins', 'Support'), array('External Users'))); $this->container['Config'] - ->expects($this->exactly(6)) + ->expects($this->exactly(3)) ->method('getUserValue') - ->will($this->onConsecutiveCalls(1024, 'foo@bar.com', - 404, 'admin@bar.com', - 2323, 'bar@dummy.com')); + ->will($this->onConsecutiveCalls(1024, 404, 2323)); $subadmin = $this->getMockBuilder('\OC\SubAdmin') ->disableOriginalConstructor() @@ -554,7 +590,7 @@ class UsersControllerTest extends \Test\TestCase { $user = $this->getMockBuilder('\OC\User\User') ->disableOriginalConstructor()->getMock(); $user - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getUID') ->will($this->returnValue('foo')); $user @@ -562,6 +598,10 @@ class UsersControllerTest extends \Test\TestCase { ->method('getDisplayName') ->will($this->returnValue('M. Foo')); $user + ->expects($this->once()) + ->method('getEMailAddress') + ->will($this->returnValue(null)); + $user ->method('getLastLogin') ->will($this->returnValue(500)); $user |