summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRoeland Douma <rullzer@users.noreply.github.com>2016-05-17 16:06:44 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-05-17 16:06:44 +0200
commit5c9103287f7ed8f2d69dd179b7eb160c1b1a65fd (patch)
tree50913dfb0dfd0c1a4036685021a29fbe8c2036a6 /tests/lib
parent90a290afd8415a8a89d72d5b4cb07988d29d7037 (diff)
downloadnextcloud-server-5c9103287f7ed8f2d69dd179b7eb160c1b1a65fd.tar.gz
nextcloud-server-5c9103287f7ed8f2d69dd179b7eb160c1b1a65fd.zip
Group fixup (#24621)
* Move used OC_Group_xx to \OC\Group * Add (deprecated) legacy wrapper in legacy, OC_Group_xx * Replace deprecated use of OC_Group_xx with \OC\Group\xx
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/group/backend.php2
-rw-r--r--tests/lib/group/database.php4
-rw-r--r--tests/lib/group/group.php46
-rw-r--r--tests/lib/group/manager.php104
-rw-r--r--tests/lib/util/group/dummy.php4
5 files changed, 80 insertions, 80 deletions
diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php
index 238b83de5d7..3b06a3eb3a9 100644
--- a/tests/lib/group/backend.php
+++ b/tests/lib/group/backend.php
@@ -31,7 +31,7 @@
*/
abstract class Test_Group_Backend extends \Test\TestCase {
/**
- * @var OC_Group_Backend $backend
+ * @var \OC\Group\Backend $backend
*/
protected $backend;
diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php
index b0be5774c7d..aae9f8bf1de 100644
--- a/tests/lib/group/database.php
+++ b/tests/lib/group/database.php
@@ -45,7 +45,7 @@ class Test_Group_Database extends Test_Group_Backend {
protected function setUp() {
parent::setUp();
- $this->backend = new OC_Group_Database();
+ $this->backend = new \OC\Group\Database();
}
protected function tearDown() {
@@ -60,7 +60,7 @@ class Test_Group_Database extends Test_Group_Backend {
$this->backend->createGroup($group);
- $backend = new OC_Group_Database();
+ $backend = new \OC\Group\Database();
$this->assertFalse($backend->createGroup($group));
}
}
diff --git a/tests/lib/group/group.php b/tests/lib/group/group.php
index d758e5959d0..bf834ab2348 100644
--- a/tests/lib/group/group.php
+++ b/tests/lib/group/group.php
@@ -32,7 +32,7 @@ class Group extends \Test\TestCase {
}
public function testGetUsersSingleBackend() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -51,8 +51,8 @@ class Group extends \Test\TestCase {
}
public function testGetUsersMultipleBackends() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -78,7 +78,7 @@ class Group extends \Test\TestCase {
}
public function testInGroupSingleBackend() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -92,8 +92,8 @@ class Group extends \Test\TestCase {
}
public function testInGroupMultipleBackends() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -112,7 +112,7 @@ class Group extends \Test\TestCase {
}
public function testAddUser() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -133,7 +133,7 @@ class Group extends \Test\TestCase {
}
public function testAddUserAlreadyInGroup() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -153,7 +153,7 @@ class Group extends \Test\TestCase {
}
public function testRemoveUser() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -174,7 +174,7 @@ class Group extends \Test\TestCase {
}
public function testRemoveUserNotInGroup() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -194,8 +194,8 @@ class Group extends \Test\TestCase {
}
public function testRemoveUserMultipleBackends() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$userBackend = $this->getMock('\OC_User_Backend');
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -228,7 +228,7 @@ class Group extends \Test\TestCase {
}
public function testSearchUsers() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -245,8 +245,8 @@ class Group extends \Test\TestCase {
}
public function testSearchUsersMultipleBackends() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -267,7 +267,7 @@ class Group extends \Test\TestCase {
}
public function testSearchUsersLimitAndOffset() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend), $userManager);
@@ -284,8 +284,8 @@ class Group extends \Test\TestCase {
}
public function testSearchUsersMultipleBackendsLimitAndOffset() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -308,7 +308,7 @@ class Group extends \Test\TestCase {
}
public function testCountUsers() {
- $backend1 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1), $userManager);
@@ -327,8 +327,8 @@ class Group extends \Test\TestCase {
}
public function testCountUsersMultipleBackends() {
- $backend1 = $this->getMock('OC_Group_Database');
- $backend2 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
+ $backend2 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@@ -354,7 +354,7 @@ class Group extends \Test\TestCase {
}
public function testCountUsersNoMethod() {
- $backend1 = $this->getMock('OC_Group_Database');
+ $backend1 = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend1), $userManager);
@@ -370,7 +370,7 @@ class Group extends \Test\TestCase {
}
public function testDelete() {
- $backend = $this->getMock('OC_Group_Database');
+ $backend = $this->getMock('OC\Group\Database');
$userManager = $this->getUserManager();
$group = new \OC\Group\Group('group1', array($backend), $userManager);
diff --git a/tests/lib/group/manager.php b/tests/lib/group/manager.php
index 410e11114c4..751f0d0ebd5 100644
--- a/tests/lib/group/manager.php
+++ b/tests/lib/group/manager.php
@@ -14,9 +14,9 @@ use OC\User\User;
class Manager extends \Test\TestCase {
public function testGet() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->any())
->method('groupExists')
->with('group1')
@@ -46,9 +46,9 @@ class Manager extends \Test\TestCase {
public function testGetNotExists() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('groupExists')
->with('group1')
@@ -82,18 +82,18 @@ class Manager extends \Test\TestCase {
public function testGetMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend1 = $this->getMock('\OC_Group_Database');
+ $backend1 = $this->getMock('\OC\Group\Database');
$backend1->expects($this->any())
->method('groupExists')
->with('group1')
->will($this->returnValue(false));
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend2
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
*/
- $backend2 = $this->getMock('\OC_Group_Database');
+ $backend2 = $this->getMock('\OC\Group\Database');
$backend2->expects($this->any())
->method('groupExists')
->with('group1')
@@ -114,10 +114,10 @@ class Manager extends \Test\TestCase {
public function testCreate() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
$backendGroupCreated = false;
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->any())
->method('groupExists')
->with('group1')
@@ -146,9 +146,9 @@ class Manager extends \Test\TestCase {
public function testCreateExists() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->any())
->method('groupExists')
->with('group1')
@@ -169,9 +169,9 @@ class Manager extends \Test\TestCase {
public function testSearch() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('getGroups')
->with('1')
@@ -196,9 +196,9 @@ class Manager extends \Test\TestCase {
public function testSearchMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend1 = $this->getMock('\OC_Group_Database');
+ $backend1 = $this->getMock('\OC\Group\Database');
$backend1->expects($this->once())
->method('getGroups')
->with('1')
@@ -208,9 +208,9 @@ class Manager extends \Test\TestCase {
->will($this->returnValue(true));
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend2
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
*/
- $backend2 = $this->getMock('\OC_Group_Database');
+ $backend2 = $this->getMock('\OC\Group\Database');
$backend2->expects($this->once())
->method('getGroups')
->with('1')
@@ -237,9 +237,9 @@ class Manager extends \Test\TestCase {
public function testSearchMultipleBackendsLimitAndOffset() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend1 = $this->getMock('\OC_Group_Database');
+ $backend1 = $this->getMock('\OC\Group\Database');
$backend1->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
@@ -249,9 +249,9 @@ class Manager extends \Test\TestCase {
->will($this->returnValue(true));
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend2
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
*/
- $backend2 = $this->getMock('\OC_Group_Database');
+ $backend2 = $this->getMock('\OC\Group\Database');
$backend2->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
@@ -278,9 +278,9 @@ class Manager extends \Test\TestCase {
public function testGetUserGroups() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -332,9 +332,9 @@ class Manager extends \Test\TestCase {
public function testInGroup() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -356,9 +356,9 @@ class Manager extends \Test\TestCase {
public function testIsAdmin() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -380,9 +380,9 @@ class Manager extends \Test\TestCase {
public function testNotAdmin() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -404,9 +404,9 @@ class Manager extends \Test\TestCase {
public function testGetUserGroupsMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend1 = $this->getMock('\OC_Group_Database');
+ $backend1 = $this->getMock('\OC\Group\Database');
$backend1->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -416,9 +416,9 @@ class Manager extends \Test\TestCase {
->will($this->returnValue(true));
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend2
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
*/
- $backend2 = $this->getMock('\OC_Group_Database');
+ $backend2 = $this->getMock('\OC\Group\Database');
$backend2->expects($this->once())
->method('getUserGroups')
->with('user1')
@@ -446,9 +446,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackend() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -510,9 +510,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -577,9 +577,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -647,9 +647,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -692,9 +692,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -736,9 +736,9 @@ class Manager extends \Test\TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitAndOffsetSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend1
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
@@ -781,9 +781,9 @@ class Manager extends \Test\TestCase {
public function testGetUserGroupsWithAddUser() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$expectedGroups = array();
$backend->expects($this->any())
->method('getUserGroups')
@@ -825,9 +825,9 @@ class Manager extends \Test\TestCase {
public function testGetUserGroupsWithRemoveUser() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$expectedGroups = array('group1');
$backend->expects($this->any())
->method('getUserGroups')
@@ -875,9 +875,9 @@ class Manager extends \Test\TestCase {
public function testGetUserIdGroups() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
+ * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
*/
- $backend = $this->getMock('\OC_Group_Database');
+ $backend = $this->getMock('\OC\Group\Database');
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
diff --git a/tests/lib/util/group/dummy.php b/tests/lib/util/group/dummy.php
index e72be827d8a..8f06316ca03 100644
--- a/tests/lib/util/group/dummy.php
+++ b/tests/lib/util/group/dummy.php
@@ -29,12 +29,12 @@
namespace Test\Util\Group;
-use OC_Group_Backend;
+use OC\Group\Backend;
/**
* dummy group backend, does not keep state, only for testing use
*/
-class Dummy extends OC_Group_Backend {
+class Dummy extends Backend {
private $groups=array();
/**
* Try to create a new group