From 87b56e294769aba1e37b9d3fd9b4375c25b75453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antal=20=C3=81ron?= Date: Tue, 10 Dec 2024 04:44:19 +0100 Subject: [PATCH 01/21] Add Disqus provider (#1002) --- docs/providers/thirdparty.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index fb0192e7..6c0178cc 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -44,6 +44,7 @@ Gateway | Composer Package | Maintainer [DeviantArt](https://github.com/SeinopSys/oauth2-deviantart) | seinopsys/oauth2-deviantart | [SeinopSys](https://github.com/SeinopSys) [DigitalOcean](https://github.com/chrishemmings/oauth2-digitalocean) | chrishemmings/oauth2-digitalocean | [Chris Hemmings](https://github.com/chrishemmings) [Discord](https://github.com/wohali/oauth2-discord-new) | wohali/oauth2-discord-new | [Joan Touzet](https://github.com/wohali) +[Disqus](https://github.com/antalaron/oauth2-disqus) | antalaron/oauth2-disqus | [Antal Áron](https://github.com/antalaron) [Docusign](https://github.com/AlaaSarhan/oauth2-docusign) | sarhan/oauth2-docusign | [Alaa Sarhan](https://github.com/AlaaSarhan) [Dokeop](https://github.com/dokeop/oauth2-dokeop) | dokeop/oauth2-dokeop | [Dokeop](https://github.com/dokeop) [DonationAlerts](https://github.com/mish-ka-mishka/oauth2-donationalerts) | mkaverin/oauth2-donationalerts | [Michael Kaverin](https://github.com/mish-ka-mishka) From 7aa0c4f6dda1fa081bb0977c352fb432442fdcf1 Mon Sep 17 00:00:00 2001 From: Max Bachhuber Date: Tue, 10 Dec 2024 04:45:08 +0100 Subject: [PATCH 02/21] Add oauth2-nextcloud to list of third party providers (#1003) --- docs/providers/thirdparty.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index 6c0178cc..ba405907 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -100,6 +100,7 @@ Gateway | Composer Package | Maintainer [Naver](https://packagist.org/packages/deminoth/oauth2-naver) | deminoth/oauth2-naver | [SangYeob Bono Yu](https://github.com/deminoth) [Netatmo](https://github.com/rugaard/oauth2-netatmo) | rugaard/oauth2-netatmo | [Morten Rugaard](https://github.com/rugaard) [Nest](https://github.com/stevenmaguire/oauth2-nest) | stevenmaguire/oauth2-nest | [Steven Maguire](https://github.com/stevenmaguire) +[Nextcloud](https://github.com/bahuma/oauth2-nextcloud) | bahuma/oauth2-nextcloud | [Max Bachhuber](https://github.com/bahuma20) [NIBE](https://github.com/olssonm/oauth2-nibe) | olssonm/oauth2-nibe | [Marcus Olsson](https://github.com/olssonm) [Odnoklassniki](https://packagist.org/packages/aego/oauth2-odnoklassniki) | aego/oauth2-odnoklassniki | [Alexey](https://github.com/rakeev) [Okta](https://packagist.org/packages/foxworth42/oauth2-okta) | foxworth42/oauth2-okta | [Ed Walker](https://github.com/foxworth42) From cc6917456080b5d55c89de07b9c59ed399a99d2b Mon Sep 17 00:00:00 2001 From: Ajtak Date: Tue, 10 Dec 2024 04:46:06 +0100 Subject: [PATCH 03/21] Added apereo CAS (#1006) --- docs/providers/thirdparty.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index ba405907..48d8c742 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -20,6 +20,7 @@ Gateway | Composer Package | Maintainer [42 School](https://github.com/mehdibo/oauth2-fortytwo/) | mehdibo/oauth2-fortytwo | [Mehdi Bounya](https://github.com/mehdibo) [Amazon](https://github.com/michaelKaefer/oauth2-amazon/) | michaelkaefer/oauth2-amazon | [Michael Käfer](https://github.com/michaelKaefer) [Amazon Cognito](https://github.com/CakeDC/oauth2-cognito/) | cakedc/oauth2-cognito | [Cake Development Corporation](https://github.com/CakeDC) +[Apereo CAS](https://github.com/ajtak/oauth2-apereo-cas) | ajtak/oauth2-apereo-cas | [Jakub Fridrich](https://github.com/Ajtak) [Apple](https://github.com/patrickbussmann/oauth2-apple) | patrickbussmann/oauth2-apple | [Patrick Bußmann](https://github.com/patrickbussmann) [Auth0](https://github.com/RiskioFr/oauth2-auth0) | riskio/oauth2-auth0 | [Nicolas Eeckeloo](https://github.com/neeckeloo) [Azure Active Directory](https://github.com/thenetworg/oauth2-azure) | thenetworg/oauth2-azure | [Jan Hajek](https://github.com/hajekj) From ed9ba779a13e1b77bf7e1355fb246afd98bff2e9 Mon Sep 17 00:00:00 2001 From: Peter Kessen Date: Tue, 10 Dec 2024 04:52:11 +0100 Subject: [PATCH 04/21] Add hint for session start to usage (#1016) --- docs/usage.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/usage.md b/docs/usage.md index 88a8c21f..d66e300e 100755 --- a/docs/usage.md +++ b/docs/usage.md @@ -27,6 +27,9 @@ $provider = new \League\OAuth2\Client\Provider\GenericProvider([ 'urlResourceOwnerDetails' => 'https://service.example.com/resource' ]); +// A session is required to store some session data for later usage +session_start(); + // If we don't have an authorization code then get one if (!isset($_GET['code'])) { From bc40e209b3ea07d3686ca1c90cf15f6cd9edbdae Mon Sep 17 00:00:00 2001 From: Jonathon Hill Date: Mon, 9 Dec 2024 22:54:32 -0500 Subject: [PATCH 05/21] Add compwright/oauth2-quickbooks-online (#1020) --- docs/providers/thirdparty.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index 48d8c742..22b49a66 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -113,6 +113,7 @@ Gateway | Composer Package | Maintainer [Pinterest](https://github.com/vantezzen/oauth2-pinterest) | vantezzen/oauth2-pinterest | [vantezzen](https://github.com/vantezzen) [Procore](https://packagist.org/packages/oxblue/oauth2-procore) | oxblue/oauth2-procore | [Chris Forrence](https://gitlab.com/chrisforrence) [PSN](https://github.com/larabros/oauth2-psn) | larabros/oauth2-psn | [Hassan Khan](https://github.com/hassankhan) +[Quickbooks Online](https://github.com/compwright/oauth2-quickbooks-online] | compwright/oauth2-quickbooks-online | [Jonathon Hill](https://compwright.com) [Rocket Beans TV](https://github.com/oliverschloebe/oauth2-rbtv) | oliverschloebe/oauth2-rbtv | [Oliver Schlöbe](https://github.com/oliverschloebe) [Rdio](https://github.com/adam-paterson/oauth2-rdio) | adam-paterson/oauth2-rdio | [Adam Paterson](https://github.com/adam-paterson) [Reddit](https://github.com/rtheunissen/oauth2-reddit) | rtheunissen/oauth2-reddit | [Rudi Theunissen](https://github.com/rtheunissen) From e4c6ec77c9082e6b215467b83ffaf73338cc3991 Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Mon, 9 Dec 2024 19:55:59 -0800 Subject: [PATCH 06/21] Fix tests by returning array from PSR7's ResponseInterface::getHeader() (#1026) * PSR7 ResponseInterface::getHeader returns array * Remove typo * Replace more getHeader calls --- test/src/Grant/GrantTestCase.php | 2 +- test/src/Provider/AbstractProviderTest.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/src/Grant/GrantTestCase.php b/test/src/Grant/GrantTestCase.php index 5451b331..125c66ce 100644 --- a/test/src/Grant/GrantTestCase.php +++ b/test/src/Grant/GrantTestCase.php @@ -65,7 +65,7 @@ public function testGetAccessToken($grant, array $params = []) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); /** @var ClientInterface & MockInterface $client */ $client = Mockery::spy(ClientInterface::class)->makePartial(); diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index b9ebf6f1..93cf97a7 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -213,7 +213,7 @@ public function testGetUserProperties($name = null, $email = null, $id = null) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ @@ -262,7 +262,7 @@ public function testGetUserPropertiesThrowsExceptionWhenNonJsonResponseIsReceive $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('text/html'); + ->andReturn(['text/html']); $client = Mockery::mock(ClientInterface::class, [ 'send' => $response, @@ -378,7 +378,7 @@ public function testPkceMethod($pkceMethod, $pkceCode, $expectedChallenge) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -474,7 +474,7 @@ public function testErrorResponsesCanBeCustomizedAtTheProvider() ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -532,7 +532,7 @@ public function testClientErrorTriggersProviderException() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::mock(ClientInterface::class); $client @@ -579,7 +579,7 @@ public function testAuthenticatedRequestAndResponse() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::mock(ClientInterface::class); $client @@ -647,7 +647,7 @@ public function testGetAccessToken($method) ->shouldReceive('getHeader') ->once() ->with('content-type') - ->andReturn('application/json'); + ->andReturn(['application/json']); $client = Mockery::spy(ClientInterface::class, [ 'send' => $response, @@ -686,7 +686,7 @@ public function testGetAccessTokenWithNonJsonResponse() $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn('text/plain'); + ->andReturn(['text/plain']); $client = Mockery::mock(ClientInterface::class, [ 'send' => $response, @@ -745,7 +745,7 @@ public function testParseResponse($body, $type, $parsed, $statusCode = 200) $response ->shouldReceive('getHeader') ->with('content-type') - ->andReturn($type); + ->andReturn([$type]); $method = $this->getMethod(AbstractProvider::class, 'parseResponse'); $result = $method->invoke($this->getMockProvider(), $response); From ba1b77790a7243bdbfef6379acd7ab6ecc8b65cf Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Mon, 9 Dec 2024 19:59:33 -0800 Subject: [PATCH 07/21] Update dockblock for AbstractProvider::prepareAccessTokenResponse (#1025) This commit updates the docblock to reflect the expected type for $result. --- src/Provider/AbstractProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 293a54d6..4f9e203d 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -815,7 +815,7 @@ abstract protected function checkResponse(ResponseInterface $response, $data); * Custom mapping of expiration, etc should be done here. Always call the * parent method when overloading this method. * - * @param mixed $result + * @param array $result * @return array */ protected function prepareAccessTokenResponse(array $result) From 88cbeb794f5ea879981035bdf140674bff588973 Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Tue, 10 Dec 2024 05:04:45 +0100 Subject: [PATCH 08/21] Send scope when requesting access tokens (#1030) Resolves: #1029 --- CHANGELOG.md | 4 ++++ composer.json | 1 + src/Provider/AbstractProvider.php | 11 ++++++++++- test/src/Grant/PasswordTest.php | 3 ++- test/src/Provider/AbstractProviderTest.php | 4 ++-- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73246e85..71ce9e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # OAuth 2.0 Client Changelog +## x.x.x + +* Send scopes with access token request [#1029](https://github.com/thephpleague/oauth2-client/issues/1029) + ## 2.7.0 _Released: 2023-04-16_ diff --git a/composer.json b/composer.json index aa006dff..085fe514 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "sort-packages": true }, "require": { + "ext-json": "*", "php": "^5.6 || ^7.0 || ^8.0", "guzzlehttp/guzzle": "^6.0 || ^7.0", "paragonie/random_compat": "^1 || ^2 || ^9.99" diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 4f9e203d..f0eb3eb3 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -620,6 +620,15 @@ public function getAccessToken($grant, array $options = []) { $grant = $this->verifyGrant($grant); + if (empty($options['scope'])) { + $options['scope'] = $this->getDefaultScopes(); + } + + if (is_array($options['scope'])) { + $separator = $this->getScopeSeparator(); + $options['scope'] = implode($separator, $options['scope']); + } + $params = [ 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, @@ -757,7 +766,7 @@ protected function parseJson($content) */ protected function getContentType(ResponseInterface $response) { - return join(';', (array) $response->getHeader('content-type')); + return implode(';', $response->getHeader('content-type')); } /** diff --git a/test/src/Grant/PasswordTest.php b/test/src/Grant/PasswordTest.php index f177eb86..85972fc0 100644 --- a/test/src/Grant/PasswordTest.php +++ b/test/src/Grant/PasswordTest.php @@ -20,7 +20,8 @@ protected function getParamExpectation() return !empty($body['grant_type']) && $body['grant_type'] === 'password' && !empty($body['username']) - && !empty($body['password']); + && !empty($body['password']) + && !empty($body['scope']); }; } diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index 93cf97a7..6f388a04 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -50,7 +50,7 @@ public function testInvalidGrantString() public function testInvalidGrantObject() { $this->expectException(InvalidGrantException::class); - $grant = new \StdClass(); + $grant = new \stdClass(); $this->getMockProvider()->getAccessToken($grant, ['invalid_parameter' => 'none']); } @@ -628,7 +628,7 @@ public function testGetAccessToken($method) ->once() ->with( ['client_id' => 'mock_client_id', 'client_secret' => 'mock_secret', 'redirect_uri' => 'none'], - ['code' => 'mock_authorization_code'] + ['code' => 'mock_authorization_code', 'scope' => 'test'] ) ->andReturn([]); From 1f2e0bb024d4e312b65ae95dd5d03e3506f7ef6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Heleno?= Date: Tue, 10 Dec 2024 01:23:36 -0300 Subject: [PATCH 09/21] Add php 8.3 to test matrix (#1033) --- .github/workflows/continuous-integration.yml | 4 ++-- README.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index baf35ea4..6a08430a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] steps: - uses: "actions/checkout@v2" - uses: "shivammathur/setup-php@v2" @@ -72,7 +72,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] steps: - uses: "actions/checkout@v2" - uses: "shivammathur/setup-php@v2" diff --git a/README.md b/README.md index 41bb2552..682cf625 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This package is compliant with [PSR-1][], [PSR-2][], [PSR-4][], and [PSR-7][]. I We support the following versions of PHP: +* PHP 8.3 * PHP 8.2 * PHP 8.1 * PHP 8.0 From eb52556e96860dbd179e33b8f64afb3a385736d7 Mon Sep 17 00:00:00 2001 From: Juliette <663378+jrfnl@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:27:19 +0100 Subject: [PATCH 10/21] Dependabot: submit PRs for GH action runners (#1036) I noticed a number of action runners used are out of date. Most updates are related to the Node version the action runners use under the hood updating to Node 20. Not having those updates will become problematic soonish when GHA drops support for Node 16. So, instead of manually updating the workflows, I've added the GHA environment to the Dependabot configuration. This should take care of it via Dependabot opening PRs to do the updates. --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a6278312..22294d71 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,8 @@ updates: directory: "/docs" schedule: interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 From c19ecc677d68cf48efe938a9cba2198ab64a42cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Tue, 10 Dec 2024 05:29:38 +0100 Subject: [PATCH 11/21] Explicitly mark nullable parameter (#1034) --- src/Provider/AbstractProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index f0eb3eb3..26f6d1c6 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -495,7 +495,7 @@ public function getAuthorizationUrl(array $options = []) */ public function authorize( array $options = [], - callable $redirectHandler = null + ?callable $redirectHandler = null ) { $url = $this->getAuthorizationUrl($options); if ($redirectHandler) { From 1801ab926d31475ee32a6f2459afd462a30512a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:30:20 -0600 Subject: [PATCH 12/21] Bump codecov/codecov-action from 2 to 5 (#1042) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6a08430a..d7b6d88a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -64,7 +64,7 @@ jobs: - name: "Run unit tests" run: "./vendor/bin/phpunit --colors=always --coverage-clover build/logs/clover.xml --coverage-text" - name: "Publish coverage report to Codecov" - uses: "codecov/codecov-action@v2" + uses: "codecov/codecov-action@v5" unit-tests: name: "Unit Tests" From 70c3799b85b888b8aea261e9793afd2ace6bf823 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:34:04 -0600 Subject: [PATCH 13/21] Bump ramsey/composer-install from 2 to 3 (#1043) Bumps [ramsey/composer-install](https://github.com/ramsey/composer-install) from 2 to 3. - [Release notes](https://github.com/ramsey/composer-install/releases) - [Commits](https://github.com/ramsey/composer-install/compare/v2...v3) --- updated-dependencies: - dependency-name: ramsey/composer-install dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/continuous-integration.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d7b6d88a..29e81f39 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -28,7 +28,7 @@ jobs: coverage: "none" ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" tools: "composer:v2" - - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v3" - name: "Lint the PHP source code" run: "./vendor/bin/parallel-lint src test" @@ -43,7 +43,7 @@ jobs: coverage: "none" ini-values: "memory_limit=-1" tools: "composer:v2" - - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v3" - name: "Check coding standards" run: "./vendor/bin/phpcs src --standard=psr2 -sp --colors" @@ -60,7 +60,7 @@ jobs: tools: "composer" - name: "Prepare for tests" run: "mkdir -p build/logs" - - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v3" - name: "Run unit tests" run: "./vendor/bin/phpunit --colors=always --coverage-clover build/logs/clover.xml --coverage-text" - name: "Publish coverage report to Codecov" @@ -83,6 +83,6 @@ jobs: tools: "composer" - name: "Prepare for tests" run: "mkdir -p build/logs" - - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v3" - name: "Run unit tests" run: "./vendor/bin/phpunit --colors=always" From a9b8925936eaac574cbe46169be01af0689318ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:34:31 -0600 Subject: [PATCH 14/21] Bump actions/checkout from 2 to 4 (#1044) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/continuous-integration.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 29e81f39..118e5c18 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,7 +21,7 @@ jobs: matrix: php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] steps: - - uses: "actions/checkout@v2" + - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" @@ -36,7 +36,7 @@ jobs: name: "Coding Standards" runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v2" + - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" with: php-version: "latest" @@ -51,7 +51,7 @@ jobs: name: "Coverage" runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v2" + - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" with: php-version: "latest" @@ -74,7 +74,7 @@ jobs: matrix: php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] steps: - - uses: "actions/checkout@v2" + - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" From b9226f341aaf0e5222e3c293dd2f7e6721cc6f24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:36:54 -0600 Subject: [PATCH 15/21] Bump github-pages from 228 to 232 in /docs (#1045) Bumps [github-pages](https://github.com/github/pages-gem) from 228 to 232. - [Release notes](https://github.com/github/pages-gem/releases) - [Commits](https://github.com/github/pages-gem/compare/v228...v232) --- updated-dependencies: - dependency-name: github-pages dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/Gemfile.lock | 152 ++++++++++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 65 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index bb6818cb..04743a50 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,46 +1,63 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.4.3) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (8.0.0) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.4) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.11.1) + coffee-script-source (1.12.2) colorator (1.1.0) - commonmarker (0.23.9) - concurrent-ruby (1.2.2) - dnsruby (1.70.0) + commonmarker (0.23.11) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + csv (3.3.0) + dnsruby (1.72.3) + base64 (~> 0.2.0) simpleidn (~> 0.2.1) + drb (2.2.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.8.1) - faraday (2.7.4) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - ffi (1.15.5) + execjs (2.10.0) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.0) forwardable-extended (2.6.0) - gemoji (3.0.1) - github-pages (228) - github-pages-health-check (= 1.17.9) - jekyll (= 3.9.3) - jekyll-avatar (= 0.7.0) - jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.4.0) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.15.1) + gemoji (4.1.0) + github-pages (232) + github-pages-health-check (= 1.18.2) + jekyll (= 3.10.0) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.5.1) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.13.0) + jekyll-github-metadata (= 2.16.1) jekyll-include-cache (= 0.2.1) jekyll-mentions (= 1.6.0) jekyll-optional-front-matter (= 0.3.2) @@ -67,30 +84,32 @@ GEM jekyll-theme-tactile (= 0.2.0) jekyll-theme-time-machine (= 0.2.0) jekyll-titles-from-headings (= 0.5.3) - jemoji (= 0.12.0) - kramdown (= 2.3.2) + jemoji (= 0.13.0) + kramdown (= 2.4.0) kramdown-parser-gfm (= 1.1.0) liquid (= 4.0.4) mercenary (~> 0.3) minima (= 2.5.1) - nokogiri (>= 1.13.6, < 2.0) - rouge (= 3.26.0) + nokogiri (>= 1.16.2, < 2.0) + rouge (= 3.30.0) terminal-table (~> 1.4) - github-pages-health-check (1.17.9) + webrick (~> 1.8) + github-pages-health-check (1.18.2) addressable (~> 2.3) dnsruby (~> 1.60) - octokit (~> 4.0) - public_suffix (>= 3.0, < 5.0) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) typhoeus (~> 1.3) html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) - i18n (1.12.0) + i18n (1.14.6) concurrent-ruby (~> 1.0) - jekyll (3.9.3) + jekyll (3.10.0) addressable (~> 2.4) colorator (~> 1.0) + csv (~> 3.0) em-websocket (~> 0.5) i18n (>= 0.7, < 2) jekyll-sass-converter (~> 1.0) @@ -101,27 +120,28 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-avatar (0.7.0) + webrick (>= 1.0) + jekyll-avatar (0.8.0) jekyll (>= 3.0, < 5.0) - jekyll-coffeescript (1.1.1) + jekyll-coffeescript (1.2.2) coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) + coffee-script-source (~> 1.12) jekyll-commonmark (1.4.0) commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.4.0) - commonmarker (~> 0.23.7) - jekyll (~> 3.9.0) + jekyll-commonmark-ghpages (0.5.1) + commonmarker (>= 0.23.7, < 1.1.0) + jekyll (>= 3.9, < 4.0) jekyll-commonmark (~> 1.4.0) rouge (>= 2.0, < 5.0) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.15.1) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.13.0) + jekyll-github-metadata (2.16.1) jekyll (>= 3.4, < 5.0) - octokit (~> 4.0, != 4.4.0) + octokit (>= 4, < 7, != 4.4.0) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) jekyll-mentions (1.6.0) @@ -192,41 +212,44 @@ GEM jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.12.0) - gemoji (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - kramdown (2.3.2) + json (2.9.0) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liquid (4.0.4) - listen (3.8.0) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.2) mercenary (0.3.6) - mini_portile2 (2.8.1) + mini_portile2 (2.8.8) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.18.0) - nokogiri (1.14.3) - mini_portile2 (~> 2.8.0) + minitest (5.25.4) + net-http (0.6.0) + uri + nokogiri (1.17.0) + mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (4.0.7) - racc (1.6.2) + public_suffix (5.1.1) + racc (1.8.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.2.5) - rouge (3.26.0) - ruby2_keywords (0.0.5) + rexml (3.3.9) + rouge (3.30.0) rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) @@ -237,18 +260,17 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - simpleidn (0.2.1) - unf (~> 0.1.4) + securerandom (0.4.0) + simpleidn (0.2.3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) unicode-display_width (1.8.0) + uri (1.0.2) + webrick (1.9.1) PLATFORMS ruby From c0d7fc60cf7376d714c2e8e5391ec6cc037ec13c Mon Sep 17 00:00:00 2001 From: Ciprian Amariei Date: Tue, 10 Dec 2024 06:38:55 +0200 Subject: [PATCH 16/21] Update thirdparty.md (#1038) Add Whatnot provider and reorder alphabetically W* providers. --- docs/providers/thirdparty.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index 22b49a66..e9b96bac 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -151,11 +151,12 @@ Gateway | Composer Package | Maintainer [Vend](https://github.com/wheniwork/oauth2-vend) | wheniwork/oauth2-vend | [When I Work](https://github.com/wheniwork) [Vimeo](https://github.com/saf33r/oauth2-vimeo) | saf33r/oauth2-vimeo | [Safeer Ahmed](https://github.com/saf33r) [Vkontakte](https://github.com/j4k/oauth2-vkontakte) | j4k/oauth2-vkontakte | [Jack W](https://github.com/j4k) -[Withings](https://github.com/waytohealth/oauth2-withings) | waytohealth/oauth2-withings | [Way to Health](https://github.com/waytohealth) -[WordPress](https://github.com/krombox/oauth2-wordpress) | krombox/oauth2-wordpress | [Roman Kapustian](https://github.com/krombox) -[Webflow](https://github.com/koalatiapp/oauth2-webflow) | koalati/oauth2-webflow | [Koalati](https://github.com/koalatiapp) [Wechat](https://github.com/oakhope/oauth2-wechat) | oakhope/oauth2-wechat | [Benji Wang](https://github.com/oakhope) [WeCounsel](https://github.com/stevenmaguire/oauth2-wecounsel) | stevenmaguire/oauth2-wecounsel | [Steven Maguire](https://github.com/stevenmaguire) +[Webflow](https://github.com/koalatiapp/oauth2-webflow) | koalati/oauth2-webflow | [Koalati](https://github.com/koalatiapp) +[Whatnot](https://github.com/acip/oauth2-whatnot) | acip/oauth2-whatnot | [Ciprian Amariei](https://github.com/acip) +[Withings](https://github.com/waytohealth/oauth2-withings) | waytohealth/oauth2-withings | [Way to Health](https://github.com/waytohealth) +[WordPress](https://github.com/krombox/oauth2-wordpress) | krombox/oauth2-wordpress | [Roman Kapustian](https://github.com/krombox) [Wrike](https://github.com/michaelKaefer/oauth2-wrike) | michaelkaefer/oauth2-wrike | [Michael Käfer](https://github.com/michaelKaefer) [Yahoo](https://packagist.org/packages/hayageek/oauth2-yahoo) | hayageek/oauth2-yahoo | [Ravishanker Kusuma](https://github.com/hayageek) [Yandex](https://packagist.org/packages/aego/oauth2-yandex) | aego/oauth2-yandex | [Alexey](https://github.com/rakeev) From c38c052c1cc84073f5a6a26888c0fb7ee23fbbc2 Mon Sep 17 00:00:00 2001 From: Jens Neumann Date: Tue, 10 Dec 2024 05:39:26 +0100 Subject: [PATCH 17/21] Update thirdparty.md (#1037) Remove third-party provider for Thingiverse in favor of the new OpenAPI from Ultimaker --- docs/providers/thirdparty.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/providers/thirdparty.md b/docs/providers/thirdparty.md index e9b96bac..0afe92cd 100755 --- a/docs/providers/thirdparty.md +++ b/docs/providers/thirdparty.md @@ -136,7 +136,6 @@ Gateway | Composer Package | Maintainer [StackExchange](https://packagist.org/packages/alexmasterov/oauth2-stackexchange) | alexmasterov/oauth2-stackexchange | [Alex Masterov](https://github.com/AlexMasterov) [SuperJob](https://packagist.org/packages/alexmasterov/oauth2-superjob) | alexmasterov/oauth2-superjob | [Alex Masterov](https://github.com/AlexMasterov) [TikTok](https://github.com/bastiaandewaele/oauth2-tiktok) | bastiaandewaele/oauth2-tiktok | [Bastiaan Dewaele](https://github.com/bastiaandewaele) -[Thingiverse](https://packagist.org/packages/freshworkx/oauth2-thingiverse) | freshworkx/oauth2-thingiverse | [Jens Neumann](https://github.com/freshworkx) [ThirtySevenSignals](https://github.com/nilesuan/oauth2-thirtysevensignals) | nilesuan/oauth2-thirtysevensignals | [Nile Suan](https://github.com/nilesuan) [Trakt.tv](https://github.com/Bogstag/oauth2-trakt) | bogstag/oauth2-trakt | [Krister Bogstag](https://github.com/Bogstag/) [Trovo](https://github.com/artandor/oauth2-trovo) | artandor/oauth2-trovo | [Nicolas Mylle](https://github.com/artandor/) From a92f67ec972ee44ac0d3b44a135baea56fe033cb Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Tue, 10 Dec 2024 05:42:32 +0100 Subject: [PATCH 18/21] Make compatible with PHP 8.4 (#1039) League\OAuth2\Client\Provider\AbstractProvider::authorize(): Implicitly marking parameter $redirectHandler as nullable is deprecated, the explicit nullable type must be used instead From e306d0c7b7a6225cf1e8d76ae69644461e7514a8 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Mon, 9 Dec 2024 23:37:53 -0600 Subject: [PATCH 19/21] Raise mimimum PHP version to 8.1 and include 8.4 for testing --- .github/workflows/continuous-integration.yml | 4 +-- composer.json | 13 ++++--- phpunit.xml | 28 --------------- phpunit.xml.dist | 36 +++++++++++++++++++ test/src/Grant/AuthorizationCodeTest.php | 2 +- test/src/Grant/ClientCredentialsTest.php | 2 +- test/src/Grant/GrantFactoryTest.php | 7 ++-- test/src/Grant/GrantTestCase.php | 7 ++-- test/src/Grant/PasswordTest.php | 2 +- test/src/Grant/RefreshTokenTest.php | 2 +- .../HttpBasicAuthOptionProviderTest.php | 16 ++++----- .../PostAuthOptionProviderTest.php | 10 +++--- test/src/Provider/AbstractProviderTest.php | 31 ++++++---------- test/src/Provider/GenericProviderTest.php | 5 +-- 14 files changed, 79 insertions(+), 86 deletions(-) delete mode 100644 phpunit.xml create mode 100644 phpunit.xml.dist diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 118e5c18..7647e313 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + php-version: [ '8.1', '8.2', '8.3', '8.4' ] steps: - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" @@ -72,7 +72,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + php-version: [ '8.1', '8.2', '8.3', '8.4' ] steps: - uses: "actions/checkout@v4" - uses: "shivammathur/setup-php@v2" diff --git a/composer.json b/composer.json index 085fe514..bf2e996e 100644 --- a/composer.json +++ b/composer.json @@ -6,16 +6,15 @@ "sort-packages": true }, "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "ext-json": "*", - "php": "^5.6 || ^7.0 || ^8.0", - "guzzlehttp/guzzle": "^6.0 || ^7.0", - "paragonie/random_compat": "^1 || ^2 || ^9.99" + "guzzlehttp/guzzle": "^7.0" }, "require-dev": { - "mockery/mockery": "^1.3.5", - "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpunit/phpunit": "^5.7 || ^6.0 || ^9.5", - "squizlabs/php_codesniffer": "^2.3 || ^3.0" + "mockery/mockery": "^1.6", + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpunit/phpunit": "^10.5 || ^11.5", + "squizlabs/php_codesniffer": "^3.11" }, "keywords": [ "oauth", diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 46accb38..00000000 --- a/phpunit.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - ./test - - - - - - src/ - - - - - - - - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..e63822b2 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + test + + + + + + + + + + src + + + + + + + + diff --git a/test/src/Grant/AuthorizationCodeTest.php b/test/src/Grant/AuthorizationCodeTest.php index bf050498..c10c6ed2 100644 --- a/test/src/Grant/AuthorizationCodeTest.php +++ b/test/src/Grant/AuthorizationCodeTest.php @@ -7,7 +7,7 @@ class AuthorizationCodeTest extends GrantTestCase { - public function providerGetAccessToken() + public static function providerGetAccessToken() { return [ ['authorization_code', ['code' => 'mock_code']], diff --git a/test/src/Grant/ClientCredentialsTest.php b/test/src/Grant/ClientCredentialsTest.php index 55375f61..6f4459a2 100644 --- a/test/src/Grant/ClientCredentialsTest.php +++ b/test/src/Grant/ClientCredentialsTest.php @@ -6,7 +6,7 @@ class ClientCredentialsTest extends GrantTestCase { - public function providerGetAccessToken() + public static function providerGetAccessToken() { return [ ['client_credentials'], diff --git a/test/src/Grant/GrantFactoryTest.php b/test/src/Grant/GrantFactoryTest.php index c8fee0f9..0fcbf9f3 100644 --- a/test/src/Grant/GrantFactoryTest.php +++ b/test/src/Grant/GrantFactoryTest.php @@ -6,13 +6,12 @@ use League\OAuth2\Client\Grant\AbstractGrant; use League\OAuth2\Client\Grant\Exception\InvalidGrantException; use League\OAuth2\Client\Test\Grant\Fake as MockGrant; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class GrantFactoryTest extends TestCase { - /** - * @dataProvider providerGetGrantDefaults - */ + #[DataProvider('providerGetGrantDefaults')] public function testGetGrantDefaults($name) { $factory = new GrantFactory(); @@ -20,7 +19,7 @@ public function testGetGrantDefaults($name) $this->assertInstanceOf(AbstractGrant::class, $grant); } - public function providerGetGrantDefaults() + public static function providerGetGrantDefaults() { return [ 'authorization_code' => ['authorization_code'], diff --git a/test/src/Grant/GrantTestCase.php b/test/src/Grant/GrantTestCase.php index 125c66ce..ceede507 100644 --- a/test/src/Grant/GrantTestCase.php +++ b/test/src/Grant/GrantTestCase.php @@ -5,6 +5,7 @@ use GuzzleHttp\ClientInterface; use Mockery; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -32,7 +33,7 @@ abstract public function testToString(); * * @return array */ - abstract public function providerGetAccessToken(); + abstract public static function providerGetAccessToken(); /** * Callback to test access token request parameters. @@ -41,9 +42,7 @@ abstract public function providerGetAccessToken(); */ abstract protected function getParamExpectation(); - /** - * @dataProvider providerGetAccessToken - */ + #[DataProvider('providerGetAccessToken')] public function testGetAccessToken($grant, array $params = []) { $provider = $this->getMockProvider(); diff --git a/test/src/Grant/PasswordTest.php b/test/src/Grant/PasswordTest.php index 85972fc0..b10f1774 100644 --- a/test/src/Grant/PasswordTest.php +++ b/test/src/Grant/PasswordTest.php @@ -7,7 +7,7 @@ class PasswordTest extends GrantTestCase { - public function providerGetAccessToken() + public static function providerGetAccessToken() { return [ ['password', ['username' => 'mock_username', 'password' => 'mock_password']], diff --git a/test/src/Grant/RefreshTokenTest.php b/test/src/Grant/RefreshTokenTest.php index c82769c8..d181abaf 100644 --- a/test/src/Grant/RefreshTokenTest.php +++ b/test/src/Grant/RefreshTokenTest.php @@ -7,7 +7,7 @@ class RefreshTokenTest extends GrantTestCase { - public function providerGetAccessToken() + public static function providerGetAccessToken() { return [ ['refresh_token', ['refresh_token' => 'mock_refresh_token']], diff --git a/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php b/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php index bfef7117..e4b4eb5d 100644 --- a/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php +++ b/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php @@ -4,19 +4,21 @@ use InvalidArgumentException; use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversMethod; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use League\OAuth2\Client\Provider\AbstractProvider; -/** - * @coversDefaultClass \League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider - */ +#[CoversClass(HttpBasicAuthOptionProvider::class)] +#[CoversMethod(HttpBasicAuthOptionProvider::class, 'getAccessTokenOptions')] class HttpBasicAuthOptionProviderTest extends TestCase { /** * data provider for testGetAccessTokenOptionsException * @return array */ - public function providerTestGetAccessTokenOptionsException() + public static function providerTestGetAccessTokenOptionsException() { return [ [['client_id' => 'test']], @@ -25,10 +27,9 @@ public function providerTestGetAccessTokenOptionsException() } /** - * @covers ::getAccessTokenOptions - * @dataProvider providerTestGetAccessTokenOptionsException * @param array $params */ + #[DataProvider('providerTestGetAccessTokenOptionsException')] public function testGetAccessTokenOptionsException($params) { $this->expectException(InvalidArgumentException::class); @@ -37,9 +38,6 @@ public function testGetAccessTokenOptionsException($params) $provider->getAccessTokenOptions(AbstractProvider::METHOD_POST, $params); } - /** - * @covers ::getAccessTokenOptions - */ public function testGetAccessTokenOptions() { $provider = new HttpBasicAuthOptionProvider(); diff --git a/test/src/OptionProvider/PostAuthOptionProviderTest.php b/test/src/OptionProvider/PostAuthOptionProviderTest.php index 4d7f9065..e1453d7c 100644 --- a/test/src/OptionProvider/PostAuthOptionProviderTest.php +++ b/test/src/OptionProvider/PostAuthOptionProviderTest.php @@ -3,17 +3,15 @@ namespace League\OAuth2\Client\Test\OptionProvider; use League\OAuth2\Client\OptionProvider\PostAuthOptionProvider; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\TestCase; use League\OAuth2\Client\Provider\AbstractProvider; -/** - * @coversDefaultClass \League\OAuth2\Client\OptionProvider\PostAuthOptionProvider - */ +#[CoversClass(PostAuthOptionProvider::class)] +#[CoversMethod(PostAuthOptionProvider::class, 'getAccessTokenOptions')] class PostAuthOptionProviderTest extends TestCase { - /** - * @covers ::getAccessTokenOptions - */ public function testGetAccessTokenOptions() { $provider = new PostAuthOptionProvider(); diff --git a/test/src/Provider/AbstractProviderTest.php b/test/src/Provider/AbstractProviderTest.php index 6f388a04..8472a132 100644 --- a/test/src/Provider/AbstractProviderTest.php +++ b/test/src/Provider/AbstractProviderTest.php @@ -4,6 +4,7 @@ use League\OAuth2\Client\OptionProvider\PostAuthOptionProvider; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionClass; use UnexpectedValueException; use GuzzleHttp\Exception\BadResponseException; @@ -181,9 +182,7 @@ public function testSetRedirectHandler() $this->assertNotFalse($state); } - /** - * @dataProvider userPropertyProvider - */ + #[DataProvider('userPropertyProvider')] public function testGetUserProperties($name = null, $email = null, $id = null) { $provider = new MockProvider([ @@ -275,7 +274,7 @@ public function testGetUserPropertiesThrowsExceptionWhenNonJsonResponseIsReceive $user = $provider->getResourceOwner($token); } - public function userPropertyProvider() + public static function userPropertyProvider() { return [ 'full response' => ['test', 'test@example.com', 1], @@ -341,9 +340,7 @@ public function testSetGetPkceCode() $this->assertEquals($pkceCode, $provider->getPkceCode()); } - /** - * @dataProvider pkceMethodProvider - */ + #[DataProvider('pkceMethodProvider')] public function testPkceMethod($pkceMethod, $pkceCode, $expectedChallenge) { $provider = $this->getMockProvider(); @@ -399,7 +396,7 @@ public function testPkceMethod($pkceMethod, $pkceCode, $expectedChallenge) }); } - public function pkceMethodProvider() + public static function pkceMethodProvider() { return [ [ @@ -599,7 +596,7 @@ public function testAuthenticatedRequestAndResponse() $this->assertContains('Bearer abc', $header); } - public function getAccessTokenMethodProvider() + public static function getAccessTokenMethodProvider() { return [ ['GET'], @@ -607,9 +604,7 @@ public function getAccessTokenMethodProvider() ]; } - /** - * @dataProvider getAccessTokenMethodProvider - */ + #[DataProvider('getAccessTokenMethodProvider')] public function testGetAccessToken($method) { $provider = new MockProvider([ @@ -708,7 +703,7 @@ private function getMethod($class, $name) return $method; } - public function parseResponseProvider() + public static function parseResponseProvider() { return [ [ @@ -729,9 +724,7 @@ public function parseResponseProvider() ]; } - /** - * @dataProvider parseResponseProvider - */ + #[DataProvider('parseResponseProvider')] public function testParseResponse($body, $type, $parsed, $statusCode = 200) { $stream = Mockery::mock(StreamInterface::class, [ @@ -765,7 +758,7 @@ public function testParseResponseNonJsonFailure() $this->testParseResponse('', 'application/xml', null, 500); } - public function getAppendQueryProvider() + public static function getAppendQueryProvider() { return [ ['test.com/?a=1', 'test.com/', '?a=1'], @@ -781,9 +774,7 @@ public function getAppendQueryProvider() ]; } - /** - * @dataProvider getAppendQueryProvider - */ + #[DataProvider('getAppendQueryProvider')] public function testAppendQuery($expected, $url, $query) { $method = $this->getMethod(AbstractProvider::class, 'appendQuery'); diff --git a/test/src/Provider/GenericProviderTest.php b/test/src/Provider/GenericProviderTest.php index 65fe93ca..f2287167 100644 --- a/test/src/Provider/GenericProviderTest.php +++ b/test/src/Provider/GenericProviderTest.php @@ -9,6 +9,7 @@ use League\OAuth2\Client\Provider\GenericResourceOwner; use League\OAuth2\Client\Token\AccessToken; use Mockery; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; use ReflectionClass; @@ -142,8 +143,8 @@ public function testCheckResponse() /** * @param array $error The error response to parse * @param array $extraOptions Any extra options to configure the generic provider with. - * @dataProvider checkResponseThrowsExceptionProvider */ + #[DataProvider('checkResponseThrowsExceptionProvider')] public function testCheckResponseThrowsException(array $error, array $extraOptions = []) { $response = Mockery::mock(ResponseInterface::class); @@ -166,7 +167,7 @@ public function testCheckResponseThrowsException(array $error, array $extraOptio $checkResponse->invokeArgs($provider, [$response, $error]); } - public function checkResponseThrowsExceptionProvider() { + public static function checkResponseThrowsExceptionProvider() { return [ [['error' => 'foobar',]], [['error' => 'foobar',] , ['responseCode' => 'code']], From b1e0861512dc83f936497c430f67dbcc2a709532 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Mon, 9 Dec 2024 23:40:52 -0600 Subject: [PATCH 20/21] Do not run coverage analysis on unit tests --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7647e313..05eb61e3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -85,4 +85,4 @@ jobs: run: "mkdir -p build/logs" - uses: "ramsey/composer-install@v3" - name: "Run unit tests" - run: "./vendor/bin/phpunit --colors=always" + run: "./vendor/bin/phpunit --colors=always --no-coverage" From b25f04b3fc12d28077ac51b615cee85376fb7a10 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Mon, 9 Dec 2024 23:43:33 -0600 Subject: [PATCH 21/21] Update README to reflect PHP versions supported --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 682cf625..b5861898 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,10 @@ This package is compliant with [PSR-1][], [PSR-2][], [PSR-4][], and [PSR-7][]. I We support the following versions of PHP: +* PHP 8.4 * PHP 8.3 * PHP 8.2 * PHP 8.1 -* PHP 8.0 -* PHP 7.4 -* PHP 7.3 -* PHP 7.2 -* PHP 7.1 -* PHP 7.0 -* PHP 5.6 ## Provider Clients