/** * @dataProvider dataIsSharingDisabledForUser * * @param string $excludeGroups * @param string $groupList * @param string $setList * @param string[] $groupIds * @param bool $expected */ public function testIsSharingDisabledForUser($excludeGroups, $groupList, $setList, $groupIds, $expected) { $user = $this->getMock('\\OCP\\IUser'); $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_exclude_groups', 'no', $excludeGroups], ['core', 'shareapi_exclude_groups_list', '', $groupList]])); if ($setList !== null) { $this->config->expects($this->once())->method('setAppValue')->with('core', 'shareapi_exclude_groups_list', $setList); } else { $this->config->expects($this->never())->method('setAppValue'); } $this->groupManager->method('getUserGroupIds')->with($user)->willReturn($groupIds); $res = $this->manager->isSharingDisabledForUser($user); $this->assertEquals($expected, $res); }