}
public function canDeleteGroup(): bool {
- return !$this->suppressDeletion && ($this->which[GroupInterface::DELETE_GROUP] !== null);
+ return !$this->suppressDeletion && $this->implementsActions(GroupInterface::DELETE_GROUP);
}
/**
/**
* Delete a group
- * @param string $gid Group Id of the group to delete
- * @return bool
+ *
* @throws \Exception
*/
- public function deleteGroup($gid) {
+ public function deleteGroup(string $gid): bool {
$plugin = $this->which[GroupInterface::DELETE_GROUP];
if ($plugin) {
$pluginManager->createGroup('group');
}
-
+
public function testCreateGroupNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements createGroup in this LDAP Backend.');
->method('deleteGroup')
->with(
$this->equalTo('group')
- );
+ )->willReturn(true);
$pluginManager->register($plugin);
- $pluginManager->deleteGroup('group');
+ $this->assertTrue($pluginManager->deleteGroup('group'));
}
-
+
public function testDeleteGroupNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements deleteGroup in this LDAP Backend.');
$pluginManager->addToGroup('uid', 'gid');
}
-
+
public function testAddToGroupNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements addToGroup in this LDAP Backend.');
$pluginManager->removeFromGroup('uid', 'gid');
}
-
+
public function testRemoveFromGroupNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements removeFromGroup in this LDAP Backend.');
$pluginManager->countUsersInGroup('gid', 'search');
}
-
+
public function testCountUsersInGroupNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements countUsersInGroup in this LDAP Backend.');
$pluginManager->getGroupDetails('gid');
}
-
+
public function testgetGroupDetailsNotRegistered() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('No plugin implements getGroupDetails in this LDAP Backend.');
$pluginManager->expects($this->once())
->method('deleteGroup')
->with('gid')
- ->willReturn('result');
+ ->willReturn(true);
$mapper = $this->getMockBuilder(GroupMapping::class)
->setMethods(['unmap'])
$ldap = new GroupLDAP($access, $pluginManager);
- $this->assertEquals($ldap->deleteGroup('gid'), 'result');
+ $this->assertTrue($ldap->deleteGroup('gid'));
}