Skip to content

Commit

Permalink
Contributing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
pelmered committed Sep 8, 2024
1 parent 45d846b commit e635b17
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

This project welcomes contributions.

New features should be covered by unit tests and linting.
Including tests increases your chances of getting the PR accepted.
I might merge even if tests are missing, but it will likely take more time.

Run `composer check` before submitting a pull request and fix what you can there to ensure that the code is up to the standard.
2 changes: 0 additions & 2 deletions src/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ public function getExpiresIn(): int

public function getHttpClient(PendingRequest $httpClient): PendingRequest
{

return match ($this->tokenType) {
self::TYPE_BEARER => $httpClient->withToken($this->accessToken),
self::TYPE_QUERY => $httpClient->withQueryParameters([$this->tokenName => $this->accessToken]),
self::TYPE_CUSTOM => $this->resolveCustomAuth($httpClient),
default => throw new InvalidArgumentException('Invalid auth type')
};

}

protected function resolveCustomAuth(PendingRequest $httpClient): PendingRequest
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ protected function setUp(): void

Http::fake(
static function (Request $request) {

if ($request->url() === 'https://example.com/oauth/token') {
if ($request->token = 'my_refresh_token') {
return Http::response([
Expand Down
4 changes: 0 additions & 4 deletions tests/Unit/RefreshTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Pelmered\LaravelHttpOAuthHelper\RefreshToken;

describe('Refresh Token Class', function () {

test('refresh token basic', function () {
Cache::clear();
$accessToken = app(RefreshToken::class)(
Expand Down Expand Up @@ -139,7 +138,6 @@
});

test('refresh token with expiry callback', function () {

$accessToken = app(RefreshToken::class)(
'https://example.com/oauth/token',
new Credentials([
Expand All @@ -158,7 +156,6 @@
Http::assertSent(static function (Request $request) {
return $request->url() === 'https://example.com/oauth/token' && $request['grant_type'] === 'client_credentials' && $request['scope'] === 'scope1 scope2';
});

});

test('get access token from custom key', function () {
Expand Down Expand Up @@ -213,5 +210,4 @@
]
);
});

})->done(assignee: 'pelmered');
1 change: 0 additions & 1 deletion tests/Unit/TokenStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Pelmered\LaravelHttpOAuthHelper\TokenStore;

it('reads and stores a token in cache', function () {

Cache::clear();
Cache::spy();

Expand Down

0 comments on commit e635b17

Please sign in to comment.