diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index 2ef60b37..260daf86 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -2,6 +2,7 @@ namespace League\OAuth2\Client\Test\Provider; +use InvalidArgumentException; use League\OAuth2\Client\OptionProvider\PostAuthOptionProvider; use Mockery; use PHPUnit\Framework\Attributes\DataProvider; @@ -62,6 +63,38 @@ public function testInvalidGrantObject() $this->getMockProvider()->getAccessToken($grant, ['invalid_parameter' => 'none']); } + public function testMissingRequestFactory() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('No request factory set'); + $provider = new Fake(); + } + + public function testMissingStreamFactory() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('No stream factory set'); + $provider = new Fake( + [], + [ + 'requestFactory' => new HttpFactory() + ] + ); + } + + public function testMissingHttpClient() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('No http client set'); + $provider = new Fake( + [], + [ + 'requestFactory' => new HttpFactory(), + 'streamFactory' => new HttpFactory() + ] + ); + } + public function testAuthorizationUrlStateParam() { $authUrl = $this->getMockProvider()->getAuthorizationUrl([