Added tests
parent
65810afe06
commit
3df7382ee1
|
@ -114,4 +114,22 @@ class GithubTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('mock_name', $user->name);
|
||||
$this->assertEquals('mock_email', $this->provider->getUserEmail($token));
|
||||
}
|
||||
|
||||
public function testGithubEnterpriseDomainUrls()
|
||||
{
|
||||
$this->provider->domain = 'https://github.company.com';
|
||||
|
||||
$client = m::mock('Guzzle\Service\Client');
|
||||
$response = m::mock('Guzzle\Http\Message\Response');
|
||||
$response->shouldReceive('getBody')->times(1)->andReturn('access_token=mock_access_token&expires=3600&refresh_token=mock_refresh_token&otherKey={1234}');
|
||||
|
||||
$client->shouldReceive('setBaseUrl')->times(1);
|
||||
$client->shouldReceive('post->send')->times(1)->andReturn($response);
|
||||
$this->provider->setHttpClient($client);
|
||||
$token = $this->provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']);
|
||||
|
||||
$this->assertEquals($this->provider->domain.'/login/oauth/authorize', $this->provider->urlAuthorize());
|
||||
$this->assertEquals($this->provider->domain.'/login/oauth/access_token', $this->provider->urlAccessToken());
|
||||
$this->assertEquals($this->provider->domain.'/api/v3/user?access_token=mock_access_token', $this->provider->urlUserDetails($token));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue