aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Group/ManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Group/ManagerTest.php')
-rw-r--r--tests/lib/Group/ManagerTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index 142532a5f4f..9a53bc8326c 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -241,6 +241,30 @@ class ManagerTest extends TestCase {
$this->assertEquals(null, $group);
}
+ public function testCreateTooLong() {
+ /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
+ $backendGroupCreated = false;
+ $backend = $this->getTestBackend(
+ GroupInterface::ADD_TO_GROUP |
+ GroupInterface::REMOVE_FROM_GOUP |
+ GroupInterface::COUNT_USERS |
+ GroupInterface::CREATE_GROUP |
+ GroupInterface::DELETE_GROUP |
+ GroupInterface::GROUP_DETAILS
+ );
+ $groupName = str_repeat('x', 256);
+ $backend->expects($this->any())
+ ->method('groupExists')
+ ->with($groupName)
+ ->willReturn(false);
+
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager->addBackend($backend);
+
+ $this->expectException(\Exception::class);
+ $group = $manager->createGroup($groupName);
+ }
+
public function testCreateExists() {
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backend = $this->getTestBackend();