Mpociot\Teamwork\Teamwork::acceptInvite PHP Method

acceptInvite() public method

public acceptInvite ( Mpociot\Teamwork\TeamInvite $invite )
$invite Mpociot\Teamwork\TeamInvite
    public function acceptInvite(TeamInvite $invite)
    {
        $this->user()->attachTeam($invite->team);
        $invite->delete();
    }

Usage Example

Exemplo n.º 1
0
 public function testCanAcceptInvite()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $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;
     $app->auth->shouldReceive('user')->andReturn($user);
     $teaminvite = m::mock('Mpociot\\Teamwork\\TeamInvite');
     $teaminvite->shouldReceive('setAttribute')->andReturnSelf();
     $teaminvite->shouldReceive('getAttribute')->andReturnSelf();
     $teaminvite->team = "1";
     $teaminvite->shouldReceive('delete')->once();
     $user->shouldReceive('attachTeam')->with($teaminvite->team);
     $teamwork->acceptInvite($teaminvite);
 }
All Usage Examples Of Mpociot\Teamwork\Teamwork::acceptInvite