mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
Fixed Controller Test
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
e6a7a9f251
commit
9440e9bb1e
3 changed files with 145 additions and 54 deletions
|
|
@ -341,7 +341,7 @@ class UsersController extends Controller {
|
|||
foreach ($batch as $user) {
|
||||
// Only add the groups, this user is a subadmin of
|
||||
$userGroups = array_values(array_intersect(
|
||||
$this->groupManager->getUserGroupNames($user),
|
||||
$this->groupManager->getUserGroupIds($user),
|
||||
$subAdminOfGroups
|
||||
));
|
||||
if (($gid !== '_disabledUsers' && $user->isEnabled()) ||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$firstGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('firstGroup'));
|
||||
$firstGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('First group'));
|
||||
$firstGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(12));
|
||||
|
|
@ -74,6 +77,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$secondGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('secondGroup'));
|
||||
$secondGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Second group'));
|
||||
$secondGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(25));
|
||||
|
|
@ -82,6 +88,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$thirdGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('thirdGroup'));
|
||||
$thirdGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Third group'));
|
||||
$thirdGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(14));
|
||||
|
|
@ -90,6 +99,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$fourthGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('admin'));
|
||||
$fourthGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Admin'));
|
||||
$fourthGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(18));
|
||||
|
|
@ -119,7 +131,7 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
'adminGroups' => array(
|
||||
0 => array(
|
||||
'id' => 'admin',
|
||||
'name' => 'admin',
|
||||
'name' => 'Admin',
|
||||
'usercount' => 0,//User count disabled 18,
|
||||
)
|
||||
),
|
||||
|
|
@ -127,17 +139,17 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
array(
|
||||
0 => array(
|
||||
'id' => 'firstGroup',
|
||||
'name' => 'firstGroup',
|
||||
'name' => 'First group',
|
||||
'usercount' => 0,//User count disabled 12,
|
||||
),
|
||||
1 => array(
|
||||
'id' => 'secondGroup',
|
||||
'name' => 'secondGroup',
|
||||
'name' => 'Second group',
|
||||
'usercount' => 0,//User count disabled 25,
|
||||
),
|
||||
2 => array(
|
||||
'id' => 'thirdGroup',
|
||||
'name' => 'thirdGroup',
|
||||
'name' => 'Third group',
|
||||
'usercount' => 0,//User count disabled 14,
|
||||
),
|
||||
)
|
||||
|
|
@ -158,6 +170,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$firstGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('firstGroup'));
|
||||
$firstGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('First group'));
|
||||
$firstGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(12));
|
||||
|
|
@ -166,6 +181,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$secondGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('secondGroup'));
|
||||
$secondGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Second group'));
|
||||
$secondGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(25));
|
||||
|
|
@ -174,6 +192,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$thirdGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('thirdGroup'));
|
||||
$thirdGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Third group'));
|
||||
$thirdGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(14));
|
||||
|
|
@ -182,6 +203,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$fourthGroup
|
||||
->method('getGID')
|
||||
->will($this->returnValue('admin'));
|
||||
$fourthGroup
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('Admin'));
|
||||
$fourthGroup
|
||||
->method('count')
|
||||
->will($this->returnValue(18));
|
||||
|
|
@ -212,7 +236,7 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
'adminGroups' => array(
|
||||
0 => array(
|
||||
'id' => 'admin',
|
||||
'name' => 'admin',
|
||||
'name' => 'Admin',
|
||||
'usercount' => 18,
|
||||
)
|
||||
),
|
||||
|
|
@ -220,17 +244,17 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
array(
|
||||
0 => array(
|
||||
'id' => 'secondGroup',
|
||||
'name' => 'secondGroup',
|
||||
'name' => 'Second group',
|
||||
'usercount' => 25,
|
||||
),
|
||||
1 => array(
|
||||
'id' => 'thirdGroup',
|
||||
'name' => 'thirdGroup',
|
||||
'name' => 'Third group',
|
||||
'usercount' => 14,
|
||||
),
|
||||
2 => array(
|
||||
'id' => 'firstGroup',
|
||||
'name' => 'firstGroup',
|
||||
'name' => 'First group',
|
||||
'usercount' => 12,
|
||||
),
|
||||
)
|
||||
|
|
@ -259,6 +283,8 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testCreateSuccessful() {
|
||||
$group = $this->getMockBuilder(Group::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->groupManager
|
||||
->expects($this->once())
|
||||
->method('groupExists')
|
||||
|
|
@ -268,7 +294,11 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
->expects($this->once())
|
||||
->method('createGroup')
|
||||
->with('NewGroup')
|
||||
->will($this->returnValue(true));
|
||||
->will($this->returnValue($group));
|
||||
$group
|
||||
->expects($this->once())
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('NewGroup'));
|
||||
|
||||
$expectedResponse = new DataResponse(
|
||||
array(
|
||||
|
|
@ -315,6 +345,9 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
->expects($this->once())
|
||||
->method('delete')
|
||||
->will($this->returnValue(true));
|
||||
$group
|
||||
->method('getDisplayName')
|
||||
->will($this->returnValue('ExistingGroup'));
|
||||
|
||||
$expectedResponse = new DataResponse(
|
||||
array(
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$foo
|
||||
->expects($this->exactly(2))
|
||||
->method('getQuota')
|
||||
->will($this->returnValue('1024'));
|
||||
->will($this->returnValue(1024));
|
||||
$foo
|
||||
->method('getLastLogin')
|
||||
->will($this->returnValue(500));
|
||||
|
|
@ -236,7 +236,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$admin
|
||||
->expects($this->exactly(2))
|
||||
->method('getQuota')
|
||||
->will($this->returnValue('404'));
|
||||
->will($this->returnValue(404));
|
||||
$admin
|
||||
->expects($this->once())
|
||||
->method('getLastLogin')
|
||||
|
|
@ -268,7 +268,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$bar
|
||||
->expects($this->exactly(2))
|
||||
->method('getQuota')
|
||||
->will($this->returnValue('2323'));
|
||||
->will($this->returnValue(2323));
|
||||
$bar
|
||||
->method('getLastLogin')
|
||||
->will($this->returnValue(3999));
|
||||
|
|
@ -296,8 +296,20 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->will($this->returnValue(array('foo' => 'M. Foo', 'admin' => 'S. Admin', 'bar' => 'B. Ar')));
|
||||
$this->groupManager
|
||||
->expects($this->exactly(3))
|
||||
->method('getUserGroupIds')
|
||||
->will($this->onConsecutiveCalls(array('Users', 'Support'), array('admins', 'Support'), array('External Users')));
|
||||
->method('getUserGroupNames')
|
||||
->will($this->onConsecutiveCalls(
|
||||
array(
|
||||
'Users' => array('displayName' => 'Users'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
array(
|
||||
'admins' => array('displayName' => 'admins'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
array(
|
||||
'External Users' => array('displayName' => 'External Users')
|
||||
)
|
||||
));
|
||||
$this->userManager
|
||||
->expects($this->at(0))
|
||||
->method('get')
|
||||
|
|
@ -319,17 +331,17 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($foo)
|
||||
->will($this->returnValue([]));
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($admin)
|
||||
->will($this->returnValue([]));
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($bar)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -347,10 +359,13 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
0 => array(
|
||||
'name' => 'foo',
|
||||
'displayname' => 'M. Foo',
|
||||
'groups' => array('Users', 'Support'),
|
||||
'groups' => array(
|
||||
'Users' => array('displayName' => 'Users'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 1024,
|
||||
'quota_bytes' => 1024,
|
||||
'quota_bytes' => 1024.0,
|
||||
'storageLocation' => '/home/foo',
|
||||
'lastLogin' => 500000,
|
||||
'backend' => 'OC_User_Database',
|
||||
|
|
@ -363,10 +378,13 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
1 => array(
|
||||
'name' => 'admin',
|
||||
'displayname' => 'S. Admin',
|
||||
'groups' => array('admins', 'Support'),
|
||||
'groups' => array(
|
||||
'admins' => array('displayName' => 'admins'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 404,
|
||||
'quota_bytes' => 404,
|
||||
'quota_bytes' => 404.0,
|
||||
'storageLocation' => '/home/admin',
|
||||
'lastLogin' => 12000,
|
||||
'backend' => Dummy::class,
|
||||
|
|
@ -379,10 +397,12 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
2 => array(
|
||||
'name' => 'bar',
|
||||
'displayname' => 'B. Ar',
|
||||
'groups' => array('External Users'),
|
||||
'groups' => array(
|
||||
'External Users' => array('displayName' => 'External Users')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 2323,
|
||||
'quota_bytes' => 2323,
|
||||
'quota_bytes' => 2323.0,
|
||||
'storageLocation' => '/home/bar',
|
||||
'lastLogin' => 3999000,
|
||||
'backend' => Dummy::class,
|
||||
|
|
@ -553,6 +573,10 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->expects($this->at(0))
|
||||
->method('getSubAdminsGroups')
|
||||
->will($this->returnValue([$subgroup1, $subgroup2]));
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroupsName')
|
||||
->will($this->returnValue([]));
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
|
|
@ -574,8 +598,8 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
'displayname' => 'B. Ar',
|
||||
'groups' => ['SubGroup1'],
|
||||
'subadmin' => [],
|
||||
'quota' => 2323,
|
||||
'quota_bytes' => 2323,
|
||||
'quota' => '2323',
|
||||
'quota_bytes' => 2323.0,
|
||||
'storageLocation' => '/home/bar',
|
||||
'lastLogin' => 3999000,
|
||||
'backend' => Dummy::class,
|
||||
|
|
@ -590,8 +614,8 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
'displayname' => 'M. Foo',
|
||||
'groups' => ['SubGroup2', 'SubGroup1'],
|
||||
'subadmin' => [],
|
||||
'quota' => 1024,
|
||||
'quota_bytes' => 1024,
|
||||
'quota' => '1024',
|
||||
'quota_bytes' => 1024.0,
|
||||
'storageLocation' => '/home/foo',
|
||||
'lastLogin' => 500000,
|
||||
'backend' => 'OC_User_Database',
|
||||
|
|
@ -606,8 +630,8 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
'displayname' => 'S. Admin',
|
||||
'groups' => ['SubGroup2'],
|
||||
'subadmin' => [],
|
||||
'quota' => 404,
|
||||
'quota_bytes' => 404,
|
||||
'quota' => '404',
|
||||
'quota_bytes' => 404.0,
|
||||
'storageLocation' => '/home/admin',
|
||||
'lastLogin' => 12000,
|
||||
'backend' => Dummy::class,
|
||||
|
|
@ -731,14 +755,26 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->will($this->returnValue([$foo, $admin, $bar]));
|
||||
$this->groupManager
|
||||
->expects($this->exactly(3))
|
||||
->method('getUserGroupIds')
|
||||
->will($this->onConsecutiveCalls(array('Users', 'Support'), array('admins', 'Support'), array('External Users')));
|
||||
->method('getUserGroupNames')
|
||||
->will($this->onConsecutiveCalls(
|
||||
array(
|
||||
'Users' => array('displayName' => 'Users'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
array(
|
||||
'admins' => array('displayName' => 'admins'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
array(
|
||||
'External Users' => array('displayName' => 'External Users')
|
||||
)
|
||||
));
|
||||
|
||||
$subadmin = $this->getMockBuilder(SubAdmin::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
->expects($this->any())
|
||||
|
|
@ -755,7 +791,10 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
0 => array(
|
||||
'name' => 'foo',
|
||||
'displayname' => 'M. Foo',
|
||||
'groups' => array('Users', 'Support'),
|
||||
'groups' => array(
|
||||
'Users' => array('displayName' => 'Users'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 1024,
|
||||
'quota_bytes' => 1024,
|
||||
|
|
@ -771,7 +810,10 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
1 => array(
|
||||
'name' => 'admin',
|
||||
'displayname' => 'S. Admin',
|
||||
'groups' => array('admins', 'Support'),
|
||||
'groups' => array(
|
||||
'admins' => array('displayName' => 'admins'),
|
||||
'Support' => array('displayName' => 'Support')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 404,
|
||||
'quota_bytes' => 404,
|
||||
|
|
@ -787,7 +829,9 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
2 => array(
|
||||
'name' => 'bar',
|
||||
'displayname' => 'B. Ar',
|
||||
'groups' => array('External Users'),
|
||||
'groups' => array(
|
||||
'External Users' => array('displayName' => 'External Users')
|
||||
),
|
||||
'subadmin' => array(),
|
||||
'quota' => 2323,
|
||||
'quota_bytes' => 2323,
|
||||
|
|
@ -857,7 +901,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
->expects($this->any())
|
||||
|
|
@ -944,7 +988,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1022,16 +1066,21 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->will($this->onConsecutiveCalls($newGroup));
|
||||
$this->groupManager
|
||||
->expects($this->once())
|
||||
->method('getUserGroupIds')
|
||||
->method('getUserGroupNames')
|
||||
->with($user)
|
||||
->will($this->onConsecutiveCalls(array('NewGroup', 'ExistingGroup')));
|
||||
->will($this->onConsecutiveCalls(
|
||||
array(
|
||||
'NewGroup' => array('displayName' => 'NewGroup'),
|
||||
'ExistingGroup' => array('displayName' => 'ExistingGroup')
|
||||
)
|
||||
));
|
||||
|
||||
$subadmin = $this->getMockBuilder(SubAdmin::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin
|
||||
->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1042,7 +1091,10 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$expectedResponse = new DataResponse(
|
||||
array(
|
||||
'name' => 'foo',
|
||||
'groups' => array('NewGroup', 'ExistingGroup'),
|
||||
'groups' => array(
|
||||
'NewGroup' => array('displayName' => 'NewGroup'),
|
||||
'ExistingGroup' => array('displayName' => 'ExistingGroup')
|
||||
),
|
||||
'storageLocation' => '/home/user',
|
||||
'backend' => 'bar',
|
||||
'lastLogin' => null,
|
||||
|
|
@ -1100,18 +1152,20 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->will($this->returnValue($newUser));
|
||||
$this->groupManager
|
||||
->expects($this->once())
|
||||
->method('getUserGroupIds')
|
||||
->method('getUserGroupNames')
|
||||
->with($user)
|
||||
->will($this->onConsecutiveCalls(['SubGroup1']));
|
||||
->will($this->onConsecutiveCalls(array('SubGroup1' =>
|
||||
array('displayName' => 'SubGroup1')
|
||||
)));
|
||||
$this->groupManager
|
||||
->expects($this->once())
|
||||
->method('getUserGroupIds')
|
||||
->method('getUserGroupNames')
|
||||
->with($newUser)
|
||||
->will($this->onConsecutiveCalls(['SubGroup1']));
|
||||
|
||||
$subadmin = $this->createMock(\OC\SubAdmin::class);
|
||||
$subadmin->expects($this->atLeastOnce())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->willReturnMap([
|
||||
[$user, [$subGroup1]],
|
||||
|
|
@ -1135,7 +1189,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$expectedResponse = new DataResponse(
|
||||
array(
|
||||
'name' => 'foo',
|
||||
'groups' => ['SubGroup1'],
|
||||
'groups' => array('SubGroup1' => array('displayName' => 'SubGroup1')),
|
||||
'storageLocation' => '/home/user',
|
||||
'backend' => 'bar',
|
||||
'lastLogin' => 0,
|
||||
|
|
@ -1563,7 +1617,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1629,7 +1683,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1676,7 +1730,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1714,7 +1768,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1771,7 +1825,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1793,7 +1847,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin->expects($this->once())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
@ -1858,6 +1912,10 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
$subadmin = $this->getMockBuilder(SubAdmin::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subadmin
|
||||
->expects($this->at(0))
|
||||
->method('getSubAdminsGroupsName')
|
||||
->will($this->returnValue([$group1, $group2]));
|
||||
$subadmin
|
||||
->expects($this->at(0))
|
||||
->method('getSubAdminsGroups')
|
||||
|
|
@ -2430,7 +2488,7 @@ class UsersControllerTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$subadmin
|
||||
->expects($this->any())
|
||||
->method('getSubAdminsGroups')
|
||||
->method('getSubAdminsGroupsName')
|
||||
->with($user)
|
||||
->will($this->returnValue([]));
|
||||
$this->groupManager
|
||||
|
|
|
|||
Loading…
Reference in a new issue