Esempio 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);
 }
Esempio n. 2
0
 public function testHasPendingInviteTrue()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $email = "*****@*****.**";
     $team_id = 1;
     $app = m::mock('App');
     $teamwork = new Teamwork($app);
     $token = "asd";
     $teaminvite = m::mock('Mpociot\\Teamwork\\TeamInvite');
     $app->shouldReceive('make')->with('Mpociot\\Teamwork\\TeamInvite')->once()->andReturn($teaminvite);
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $teaminvite->shouldReceive('where')->once()->with('email', "=", $email)->andReturnSelf();
     $teaminvite->shouldReceive('where')->once()->with('team_id', "=", $team_id)->andReturnSelf();
     $teaminvite->shouldReceive('first')->once()->andReturnSelf();
     $this->assertTrue($teamwork->hasPendingInvite($email, $team_id));
 }
Esempio n. 3
0
 /**
  * 
  *
  * @param \Mpociot\Teamwork\TeamInvite $invite
  * @static 
  */
 public static function denyInvite($invite)
 {
     return \Mpociot\Teamwork\Teamwork::denyInvite($invite);
 }