summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-06-08 12:11:22 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-06-08 12:11:22 +0200
commitf051b7381ba00d538dd5ad0b1ba5b016d4aa62b1 (patch)
tree1ad3f14faa57dcdff8198f30ace4a5ed4f396c59 /tests
parent2fb1b0864adea92102d8c91d92681dc0ef0bbafc (diff)
parentd683752b37dd2ed40cddbc446e326015b3036ad3 (diff)
downloadnextcloud-server-f051b7381ba00d538dd5ad0b1ba5b016d4aa62b1.tar.gz
nextcloud-server-f051b7381ba00d538dd5ad0b1ba5b016d4aa62b1.zip
Merge pull request #16402 from owncloud/issue-15956-slow-group-usercount
Sort user groups by group name and hide the user count
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/group/metadata.php9
-rw-r--r--tests/settings/controller/groupscontrollertest.php18
2 files changed, 14 insertions, 13 deletions
diff --git a/tests/lib/group/metadata.php b/tests/lib/group/metadata.php
index 94944189cad..3f4019c2fac 100644
--- a/tests/lib/group/metadata.php
+++ b/tests/lib/group/metadata.php
@@ -16,7 +16,7 @@ class Test_MetaData extends \Test\TestCase {
->getMock();
}
- private function getGroupMock() {
+ private function getGroupMock($countCallCount = 0) {
$group = $this->getMockBuilder('\OC\Group\Group')
->disableOriginalConstructor()
->getMock();
@@ -28,7 +28,7 @@ class Test_MetaData extends \Test\TestCase {
'g2', 'g2', 'g2',
'g3', 'g3', 'g3'));
- $group->expects($this->exactly(3))
+ $group->expects($this->exactly($countCallCount))
->method('count')
->with('')
->will($this->onConsecutiveCalls(2, 3, 5));
@@ -54,14 +54,15 @@ class Test_MetaData extends \Test\TestCase {
$this->assertSame(2, count($ordinaryGroups));
$this->assertSame('g2', $ordinaryGroups[0]['name']);
- $this->assertSame(3, $ordinaryGroups[0]['usercount']);
+ // user count is not loaded
+ $this->assertSame(0, $ordinaryGroups[0]['usercount']);
}
public function testGetWithSorting() {
$groupManager = $this->getGroupManagerMock();
$groupMetaData = new \OC\Group\MetaData('foo', true, $groupManager);
$groupMetaData->setSorting($groupMetaData::SORT_USERCOUNT);
- $group = $this->getGroupMock();
+ $group = $this->getGroupMock(3);
$groups = array_fill(0, 3, $group);
$groupManager->expects($this->once())
diff --git a/tests/settings/controller/groupscontrollertest.php b/tests/settings/controller/groupscontrollertest.php
index 4b6c9d02566..3c15754846c 100644
--- a/tests/settings/controller/groupscontrollertest.php
+++ b/tests/settings/controller/groupscontrollertest.php
@@ -111,26 +111,26 @@ class GroupsControllerTest extends \Test\TestCase {
0 => array(
'id' => 'admin',
'name' => 'admin',
- 'usercount' => 18
+ 'usercount' => 0,//User count disabled 18,
)
),
'groups' =>
array(
0 => array(
+ 'id' => 'firstGroup',
+ 'name' => 'firstGroup',
+ 'usercount' => 0,//User count disabled 12,
+ ),
+ 1 => array(
'id' => 'secondGroup',
'name' => 'secondGroup',
- 'usercount' => 25
+ 'usercount' => 0,//User count disabled 25,
),
- 1 => array(
+ 2 => array(
'id' => 'thirdGroup',
'name' => 'thirdGroup',
- 'usercount' => 14
+ 'usercount' => 0,//User count disabled 14,
),
- 2 => array(
- 'id' => 'firstGroup',
- 'name' => 'firstGroup',
- 'usercount' => 12
- )
)
)
)