Last active
June 25, 2019 03:28
-
-
Save rslhdyt/1852f6aafb5de7220c6a27b734c7caa9 to your computer and use it in GitHub Desktop.
[Socialite Custom Driver Test] Mock socialite with custom driver #laravel #php #socialite #mock #phpunit
This file contains hidden or 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
// app/Providers/AppServiceProvider.php | |
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use App\Services\FooApp\FooAppSocialite; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
} | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory'); | |
$socialite->extend( | |
'foo_app', | |
function ($app) use ($socialite) { | |
$config = $app['config']['services']['foo_app']; | |
return $socialite->buildProvider(FooAppSocialite::class, $config); | |
} | |
); | |
} | |
} |
This file contains hidden or 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
// config/services.php | |
<?php | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| Third Party Services | |
|-------------------------------------------------------------------------- | |
| | |
| This file is for storing the credentials for third party services such | |
| as Stripe, Mailgun, SparkPost and others. This file provides a sane | |
| default location for this type of information, allowing packages | |
| to have a conventional place to find your various credentials. | |
| | |
*/ | |
.... | |
'foo_app' => [ | |
'url' => env('FOO_APP_URL'), | |
'client_id' => env('FOO_APP_CLIENT_ID'), | |
'client_secret' => env('FOO_APP_CLIENT_SECRET'), | |
'redirect' => env('FOO_APP_CALLBACK_URL', 'http://fooapp.local/oauth/callback'), | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment