-
Notifications
You must be signed in to change notification settings - Fork 939
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: assert refresh token works on Google refresh
- Loading branch information
1 parent
5e6e996
commit a21a7da
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Laravel\Socialite\Tests\Fixtures; | ||
|
||
use Laravel\Socialite\Two\GoogleProvider; | ||
use Laravel\Socialite\Two\User; | ||
use Mockery as m; | ||
use stdClass; | ||
|
||
class GoogleTestProviderStub extends GoogleProvider | ||
{ | ||
/** | ||
* @var \GuzzleHttp\Client|\Mockery\MockInterface | ||
*/ | ||
public $http; | ||
|
||
protected function getAuthUrl($state) | ||
{ | ||
return $this->buildAuthUrlFromBase('http://auth.url', $state); | ||
} | ||
|
||
protected function getTokenUrl() | ||
{ | ||
return 'http://token.url'; | ||
} | ||
|
||
protected function getUserByToken($token) | ||
{ | ||
return ['id' => 'foo']; | ||
} | ||
|
||
protected function mapUserToObject(array $user) | ||
{ | ||
return (new User)->map(['id' => $user['id']]); | ||
} | ||
|
||
/** | ||
* Get a fresh instance of the Guzzle HTTP client. | ||
* | ||
* @return \GuzzleHttp\Client|\Mockery\MockInterface | ||
*/ | ||
protected function getHttpClient() | ||
{ | ||
if ($this->http) { | ||
return $this->http; | ||
} | ||
|
||
return $this->http = m::mock(stdClass::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters