public function testAddMember() { $email = Utils::randomEmail(); $user = new User(); $user->setEmail($email); $newUser = Utils::getBuddy()->getApiMembers()->addWorkspaceMember($user, Utils::getWorkspaceDomain()); $this->assertInstanceOf('Buddy\\Objects\\User', $newUser); $this->assertEquals($email, $newUser->getEmail()); }
public function addMember() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $user = new User(); $user->setEmail('*****@*****.**'); $resp = $buddy->getApiMembers()->addWorkspaceMember($user, 'domain'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }
/** * @return User */ public static function addUser() { $user = new User(); $user->setEmail(self::randomEmail()); return Utils::getBuddy()->getApiMembers()->addWorkspaceMember($user, self::getWorkspaceDomain()); }