Skip to content

Commit

Permalink
Merge pull request #408 from jdrzejb/feature/change-default-graph-ver…
Browse files Browse the repository at this point in the history
…sion

[4.x] Change default graph version, manually set desired version
  • Loading branch information
taylorotwell authored Nov 15, 2019
2 parents 1560838 + 5efa2be commit 220e127
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/Two/FacebookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FacebookProvider extends AbstractProvider implements ProviderInterface
*
* @var string
*/
protected $version = 'v3.0';
protected $version = 'v3.3';

/**
* The user fields being requested.
Expand Down Expand Up @@ -175,4 +175,17 @@ public function reRequest()

return $this;
}

/**
* Specify which graph version should be used.
*
* @param string $version
* @return $this
*/
public function usingGraphVersion(string $version)
{
$this->version = $version;

return $this;
}
}
2 changes: 1 addition & 1 deletion tests/OAuthTwoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testUserReturnsAUserInstanceForTheAuthenticatedFacebookRequest()
$provider = new FacebookTestProviderStub($request, 'client_id', 'client_secret', 'redirect_uri');
$provider->http = m::mock(stdClass::class);
$postKey = (version_compare(ClientInterface::VERSION, '6') === 1) ? 'form_params' : 'body';
$provider->http->shouldReceive('post')->once()->with('https://graph.facebook.com/v3.0/oauth/access_token', [
$provider->http->shouldReceive('post')->once()->with('https://graph.facebook.com/v3.3/oauth/access_token', [
$postKey => ['client_id' => 'client_id', 'client_secret' => 'client_secret', 'code' => 'code', 'redirect_uri' => 'redirect_uri'],
])->andReturn($response = m::mock(stdClass::class));
$response->shouldReceive('getBody')->once()->andReturn(json_encode(['access_token' => 'access_token', 'expires' => 5183085]));
Expand Down

0 comments on commit 220e127

Please sign in to comment.