Skip to content

Commit

Permalink
Improve AbstractProvider code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Dec 10, 2024
1 parent 2de9e08 commit 5ca87bd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/src/Provider/AbstractProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand Down

0 comments on commit 5ca87bd

Please sign in to comment.