diff --git a/src/Helpers/ConfigRetriever.php b/src/Helpers/ConfigRetriever.php index e978767..f3c2147 100644 --- a/src/Helpers/ConfigRetriever.php +++ b/src/Helpers/ConfigRetriever.php @@ -39,7 +39,9 @@ public function fromServices($providerName, array $additionalConfigKeys = []) $this->providerName = $providerName; $this->getConfigFromServicesArray($providerName); - $this->additionalConfigKeys = $additionalConfigKeys = array_unique($additionalConfigKeys + ['guzzle']); + $this->additionalConfigKeys = $additionalConfigKeys = array_unique( + array_merge($additionalConfigKeys, ['guzzle']), + ); return new Config( $this->getFromServices('client_id'), diff --git a/tests/ConfigRetrieverTest.php b/tests/ConfigRetrieverTest.php index c35f9bb..99d9187 100644 --- a/tests/ConfigRetrieverTest.php +++ b/tests/ConfigRetrieverTest.php @@ -76,6 +76,39 @@ public function it_retrieves_a_config_from_the_services(): void $this->assertSame($uri, $result['redirect']); $this->assertSame($additionalConfigItem, $result['additional']); } + + /** + * @test + */ + public function it_retrieves_a_config_from_the_services_with_guzzle(): void + { + $providerName = 'test'; + $key = 'key'; + $secret = 'secret'; + $uri = 'uri'; + $additionalConfigItem = 'test'; + $config = [ + 'client_id' => $key, + 'client_secret' => $secret, + 'redirect' => $uri, + 'additional' => $additionalConfigItem, + 'guzzle' => ['verify' => false], + ]; + self::$functions + ->shouldReceive('config') + ->with("services.{$providerName}") + ->once() + ->andReturn($config); + $configRetriever = new ConfigRetriever(); + + $result = $configRetriever->fromServices($providerName, ['additional'])->get(); + + $this->assertSame($key, $result['client_id']); + $this->assertSame($secret, $result['client_secret']); + $this->assertSame($uri, $result['redirect']); + $this->assertSame($additionalConfigItem, $result['additional']); + $this->assertSame(['verify' => false], $result['guzzle']); + } } namespace SocialiteProviders\Manager\Helpers;