From 8f7717e8ebdcd429beb6e28a98599de317309b30 Mon Sep 17 00:00:00 2001 From: "Israel J. Carberry" Date: Wed, 26 Oct 2022 14:33:45 -0500 Subject: [PATCH 1/2] Adds Symfony 6 support. Co-authored-by: Aaron Opela --- composer.json | 2 +- phpunit.xml.dist | 1 - tests/OAuth2ImplicitGrantTypeTest.php | 2 +- tests/OAuth2OutputTest.php | 4 ++-- tests/OAuth2Test.php | 18 +++++++++--------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 16e9ecc..d1fe064 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^5.5.9 || ^7.0.8 || ^7.1.3 || ^7.2.5 || ^8.0.0", - "symfony/http-foundation": "~3.0|~4.0|~5.0" + "symfony/http-foundation": "~3.0|~4.0|~5.0|~6.0" }, "require-dev": { "phpunit/phpunit": "^5.0 || ^6.0 || ^8.0 || ^9.0.0" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c27823d..4d8da63 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="vendor/autoload.php" > diff --git a/tests/OAuth2ImplicitGrantTypeTest.php b/tests/OAuth2ImplicitGrantTypeTest.php index b7d0b54..0d22e12 100644 --- a/tests/OAuth2ImplicitGrantTypeTest.php +++ b/tests/OAuth2ImplicitGrantTypeTest.php @@ -30,7 +30,7 @@ public function testGrantAccessTokenWithGrantImplicit() 'state' => '42', ))); - $this->assertRegExp('/^http:\/\/www.example.com\/\?foo=bar#state=42&access_token=[^"]+&expires_in=3600&token_type=bearer$/', $response->headers->get('Location')); + $this->assertMatchesRegularExpression('/^http:\/\/www.example.com\/\?foo=bar#state=42&access_token=[^"]+&expires_in=3600&token_type=bearer$/', $response->headers->get('Location')); } /** diff --git a/tests/OAuth2OutputTest.php b/tests/OAuth2OutputTest.php index d5ce975..804ec32 100644 --- a/tests/OAuth2OutputTest.php +++ b/tests/OAuth2OutputTest.php @@ -35,7 +35,7 @@ public function testGrantAccessTokenWithGrantAuthCodeSuccess() $response = $this->fixture->grantAccessToken($request); // Successful token grant will return a JSON encoded token: - $this->assertRegExp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent()); + $this->assertMatchesRegularExpression('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent()); } /** @@ -58,7 +58,7 @@ public function testGrantAccessTokenWithGrantAuthCodeSuccessWithoutRedirect() $response = $this->fixture->grantAccessToken($request); // Successful token grant will return a JSON encoded token: - $this->assertRegExp('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent()); + $this->assertMatchesRegularExpression('/{"access_token":".*","expires_in":\d+,"token_type":"bearer"/', $response->getContent()); } // Utility methods diff --git a/tests/OAuth2Test.php b/tests/OAuth2Test.php index e9c4288..dd43deb 100644 --- a/tests/OAuth2Test.php +++ b/tests/OAuth2Test.php @@ -215,7 +215,7 @@ public function testGrantAccessTokenWithClientCredentialsSuccess() $response = $this->fixture->grantAccessToken($request); // Successful token grant will return a JSON encoded token WITHOUT a refresh token: - $this->assertRegExp('/^{"access_token":"[^"]+","expires_in":[^"]+,"token_type":"bearer","scope":null}$/', $response->getContent()); + $this->assertMatchesRegularExpression('/^{"access_token":"[^"]+","expires_in":[^"]+,"token_type":"bearer","scope":null}$/', $response->getContent()); } /** @@ -425,7 +425,7 @@ public function testGrantAccessTokenWithGrantUser() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":null}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":null}', $response->getContent()); $token = $stub->getLastAccessToken(); $this->assertSame('cid', $token->getClientId()); @@ -490,7 +490,7 @@ public function testGrantAccessTokenWithGrantUserWithScope() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1 scope2"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1 scope2"}', $response->getContent()); $token = $stub->getLastAccessToken(); $this->assertSame('cid', $token->getClientId()); @@ -524,7 +524,7 @@ public function testGrantAccessTokenWithGrantUserWithReducedScope() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1"}', $response->getContent()); $token = $stub->getLastAccessToken(); $this->assertSame('cid', $token->getClientId()); @@ -557,7 +557,7 @@ public function testGrantAccessTokenWithGrantUserWithNoScope() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1 scope2"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":"scope1 scope2"}', $response->getContent()); $token = $stub->getLastAccessToken(); $this->assertSame('cid', $token->getClientId()); @@ -646,7 +646,7 @@ public function testGrantAccessTokenWithGrantExtension() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer"}', $response->getContent()); } /** @@ -682,7 +682,7 @@ public function testGrantAccessTokenWithGrantExtensionLimitedLifetime() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":86400,"token_type":"bearer"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":86400,"token_type":"bearer"}', $response->getContent()); } /** @@ -719,7 +719,7 @@ public function testGrantAccessTokenWithGrantExtensionJwtBearer() array('date' => null) )); - $this->assertRegExp('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":null,"refresh_token":"[^"]+"}', $response->getContent()); + $this->assertMatchesRegularExpression('{"access_token":"[^"]+","expires_in":3600,"token_type":"bearer","scope":null,"refresh_token":"[^"]+"}', $response->getContent()); $token = $stub->getLastAccessToken(); $this->assertSame('cid', $token->getClientId()); @@ -760,7 +760,7 @@ public function testFinishClientAuthorization() ))); $this->assertSame(302, $response->getStatusCode()); - $this->assertRegExp('#^http://www\.example\.com/\?foo=bar&state=42&code=#', $response->headers->get('location')); + $this->assertMatchesRegularExpression('#^http://www\.example\.com/\?foo=bar&state=42&code=#', $response->headers->get('location')); $code = $stub->getLastAuthCode(); $this->assertSame('blah', $code->getClientId()); From 5fc8ee4f09a2aca02372b6d94c184520007093f7 Mon Sep 17 00:00:00 2001 From: "Israel J. Carberry" Date: Wed, 26 Oct 2022 14:41:15 -0500 Subject: [PATCH 2/2] Removes support for older PHP versions. --- .github/workflows/ci.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e73684d..7a6b5fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: 'ubuntu-latest' strategy: matrix: - php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] + php: [ '7.3', '7.4', '8.0' ] steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index d1fe064..9e63aab 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { - "php": "^5.5.9 || ^7.0.8 || ^7.1.3 || ^7.2.5 || ^8.0.0", + "php": "^7.3 || ^8.0", "symfony/http-foundation": "~3.0|~4.0|~5.0|~6.0" }, "require-dev": {