private function setMockUserGroupsService($success = true)
{
$mockUserGroupsService = $this->getMockBuilder(UserGroupsService::class)->disableOriginalConstructor()->getMock();
$mockUserGroupsService->expects($this->any())->method('getAllGroups')->with('handle')->willReturn($this->getMockuserGroups(2));
$mockUserGroupsService->expects($this->any())->method('saveGroup')->with($this->isInstanceOf(UserGroupModel::class))->willReturn($success);
$this->setComponent(Craft::app(), 'userGroups', $mockUserGroupsService);
return $mockUserGroupsService;
}