Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2019-11-25 19:16:40 +0300
committerGitHub <noreply@github.com>2019-11-25 19:16:40 +0300
commitb1dffc5c2dd17216c87788bf36b8e15b45be2241 (patch)
tree164de89542956784da0c7046c5fb00c09aa423ea /tests/lib/Group
parent279c0cb2ed99c3914f19468c267344aa3a2f04e6 (diff)
parentb4408e4245ca4045df7a5f8fdf6ba9100730fa4f (diff)
Merge pull request #17896 from nextcloud/fix/noid/consider-create-group-result
take group creation result into consideration
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 33c2daa9476..3069f9d148b 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -191,6 +191,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);
@@ -200,6 +201,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();