SocialiteProviders\Manager\SocialiteWasCalled::extendSocialite PHP Method

extendSocialite() public method

public extendSocialite ( string $providerName, string $providerClass, string $oauth1Server = null )
$providerName string 'meetup'
$providerClass string 'Your\Name\Space\ClassNameProvider' must extend either Laravel\Socialite\Two\AbstractProvider or Laravel\Socialite\One\AbstractProvider
$oauth1Server string 'Your\Name\Space\ClassNameServer' must extend League\OAuth1\Client\Server\Server
    public function extendSocialite($providerName, $providerClass, $oauth1Server = null)
    {
        /** @var SocialiteManager $socialite */
        $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class);
        $provider = $this->buildProvider($socialite, $providerName, $providerClass, $oauth1Server);
        $socialite->extend($providerName, function () use($provider) {
            if (defined('SOCIALITEPROVIDERS_STATELESS') && SOCIALITEPROVIDERS_STATELESS) {
                return $provider->stateless();
            }
            return $provider;
        });
    }

Usage Example

Beispiel #1
0
 /**
  * @test
  */
 public function it_throws_if_given_an_invalid_oauth1_server()
 {
     $this->expectManagerInvalidArgumentException();
     $providerName = 'bar';
     $socialite = $this->socialiteMock();
     $socialite->shouldReceive('formatConfig')->with($this->config())->andReturn($this->oauth1FormattedConfig($this->config()));
     $app = $this->appMock();
     $app->shouldReceive('make')->andReturn($socialite);
     $app->shouldReceive('offsetGet')->andReturn($this->servicesArray($providerName));
     $s = new SocialiteWasCalled($app);
     $s->extendSocialite($providerName, $this->oauth1ProviderStubName(), $this->invalidClass());
 }
All Usage Examples Of SocialiteProviders\Manager\SocialiteWasCalled::extendSocialite