aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Group
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-10-08 18:05:13 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-11-25 14:01:20 +0100
commit7b1eedb11e5f55d563831d8e58c44e615267669c (patch)
tree8d0b83f503186aa4cfff396ae327c05b0478fe5b /tests/lib/Group
parent20ec763337428f3a0e7c9e34e0246c1f5fb3a838 (diff)
downloadnextcloud-server-7b1eedb11e5f55d563831d8e58c44e615267669c.tar.gz
nextcloud-server-7b1eedb11e5f55d563831d8e58c44e615267669c.zip
take group creation result into consideration
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/lib/Group')
-rw-r--r--tests/lib/Group/ManagerTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index 32e30217759..b8f798832d2 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -190,6 +190,7 @@ class ManagerTest extends TestCase {
->method('createGroup')
->will($this->returnCallback(function () use (&$backendGroupCreated) {
$backendGroupCreated = true;
+ return true;
}));
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
@@ -199,6 +200,35 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group->getGID());
}
+ public function testCreateFailure() {
+ /**@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
+ );
+ $backend->expects($this->any())
+ ->method('groupExists')
+ ->with('group1')
+ ->willReturn(false);
+ $backend->expects($this->once())
+ ->method('createGroup')
+ ->willReturn(false);
+ $backend->expects($this->once())
+ ->method('getGroupDetails')
+ ->willReturn([]);
+
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
+ $manager->addBackend($backend);
+
+ $group = $manager->createGroup('group1');
+ $this->assertEquals(null, $group);
+ }
+
public function testCreateExists() {
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Backend $backend */
$backend = $this->getTestBackend();