hasPendingInvite() public method

Checks if the given email address has a pending invite for the provided Team
public hasPendingInvite ( $email, Team | array | integer $team ) : boolean
$email
$team Team | array | integer
return boolean
示例#1
0
 public function testHasPendingInviteFromArray()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $email = "*****@*****.**";
     $team_id = 1;
     $app = m::mock('App');
     $teamwork = new Teamwork($app);
     $team = ["id" => $team_id];
     $token = "asd";
     $inviteClass = 'Mpociot\\Teamwork\\TeamInvite';
     Config::shouldReceive('get')->once()->with('teamwork.invite_model')->andReturn($inviteClass);
     $teaminvite = m::mock($inviteClass);
     $app->shouldReceive('make')->with($inviteClass)->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));
 }
示例#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));
 }
示例#3
0
 /**
  * Checks if the given email address has a pending invite for the
  * provided Team
  *
  * @param $email
  * @param \Mpociot\Teamwork\Team|array|integer $team
  * @return bool 
  * @static 
  */
 public static function hasPendingInvite($email, $team)
 {
     return \Mpociot\Teamwork\Teamwork::hasPendingInvite($email, $team);
 }