public function testCanNotInviteToUserWithoutEmail() { /* |------------------------------------------------------------ | Set |------------------------------------------------------------ */ $email = "*****@*****.**"; $team_id = 1; $app = m::mock('App'); $teamwork = new Teamwork($app); $app->auth = m::mock('Auth'); $user = m::mock('User'); $user->current_team_id = $team_id; $user->shouldReceive('getKey')->never(); $app->auth->shouldReceive('user')->andReturn($user); $app->shouldReceive('make')->with('Mpociot\\Teamwork\\TeamInvite')->never(); $this->setExpectedException('Exception', 'The provided object has no "email" attribute and is not a string.'); $teamwork->inviteToTeam($user); }
/** * Invite an email adress to a team. * * Either provide a email address or an object with an email property. * * If no team is given, the current_team_id will be used instead. * * @param string|\Mpociot\Teamwork\User $user * @param null|\Mpociot\Teamwork\Team $team * @param callable $success * @throws \Exception * @static */ public static function inviteToTeam($user, $team = null, $success = null) { return \Mpociot\Teamwork\Teamwork::inviteToTeam($user, $team, $success); }