public function testEditGroupOnlyName() { $group = Utils::addGroup(); $newGroup = new Group(); $newGroup->setName(Utils::randomString()); $resp = Utils::getBuddy()->getApiGroups()->editGroup($newGroup, Utils::getWorkspaceDomain(), $group->getId()); $this->assertInstanceOf('Buddy\\Objects\\Group', $resp); $this->assertEquals($group->getId(), $resp->getId()); $this->assertEquals($newGroup->getName(), $resp->getName()); $this->assertEquals($group->getDescription(), $resp->getDescription()); }
public function editGroup() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $group = new Group(); $group->setName('new name'); $resp = $buddy->getApiGroups()->editGroup($group, 'domain', 1); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
/** * @return Group */ public static function addGroup() { $group = new Group(); $group->setName(Utils::randomString()); $group->setDescription(Utils::randomString()); return self::getBuddy()->getApiGroups()->addGroup($group, self::getWorkspaceDomain()); }
/** * @param Group $group * @param string $domain * @param int $groupId * @param null|string $accessToken * @return Group */ public function editGroup(Group $group, $domain, $groupId, $accessToken = null) { return $this->patchJson($accessToken, ['name' => $group->getName(), 'description' => $group->getDescription()], '/workspaces/:domain/groups/:group_id', ['domain' => $domain, 'group_id' => $groupId])->getAsGroup(); }