diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 62badae4..a3718e8d 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: php: [7.4, 8.0, 8.1, 8.2] - laravel: [6.*, 7.*, 8.*, 9.*, 10.*] + laravel: [6.*, 7.*, 8.*, 9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] os: [ubuntu-latest] coverage: [none] @@ -41,6 +41,12 @@ jobs: php: 7.4 - laravel: 10.* php: 8.0 + - laravel: 11.* + php: 7.4 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 8.1 include: - laravel: 6.* dotenv: ^3.3 @@ -57,6 +63,9 @@ jobs: - laravel: 10.* dotenv: ^5.4.1 + - laravel: 11.* + dotenv: ^5.4.1 + - php: 8.0 laravel: 9.* stability: prefer-stable @@ -82,7 +91,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: mbstring json openssl - coverage: ${{ matrix.coverage }} + coverage: xdebug ini-values: memory_limit=-1 - name: Setup Problem Matchers @@ -94,9 +103,18 @@ jobs: id: composer-cache run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT - - name: Set Minimum PHP 8.0 Versions + - name: Set phpunit for PHP >= 8 but Laravel < 11 run: composer require phpunit/phpunit:^9.4 --no-interaction --no-progress --no-update - if: matrix.php >= 8 + if: matrix.php >= 8 || matrix.laravel != '11.*' + + - name: Set phpunit for Laravel >= 11 + run: composer require phpunit/phpunit:^10 --no-interaction --no-progress --no-update + if: matrix.laravel == '11.*' + + # Packages which are not striclty required for testing but could cause + # conflicts with other packages + - name: Remove packages not necessary + run: composer remove --dev rector/rector --no-interaction --no-progress --no-update - name: Set Minimum Laravel ${{ matrix.laravel }} Versions run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index eefd8712..00a5001e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ You can find and compare releases at the GitHub release page. ### Added - Different TTL configurations for each guard - lcobucci/jwt: add array support for `aud` claim +- Laravel 11 support + +## [2.1.0] 2023-02-17 + +### Added +- Laravel 10 support ## [2.0.0] 2022-09-08 - No changes to 2.0.0-RC1 diff --git a/composer.json b/composer.json index ccb16f27..e970f1fe 100644 --- a/composer.json +++ b/composer.json @@ -35,19 +35,19 @@ "require": { "php": "^7.4|^8.0", "ext-json": "*", - "illuminate/auth": "^6|^7|^8.67|^9|^10", - "illuminate/contracts": "^6|^7|^8.67|^9|^10", - "illuminate/http": "^6|^7|^8.67|^9|^10", - "illuminate/support": "^6|^7|^8.67|^9|^10", + "illuminate/auth": "^6|^7|^8.67|^9|^10|^11", + "illuminate/contracts": "^6|^7|^8.67|^9|^10|^11", + "illuminate/http": "^6|^7|^8.67|^9|^10|^11", + "illuminate/support": "^6|^7|^8.67|^9|^10|^11", "lcobucci/jwt": "^4.0", "namshi/jose": "^7.0", "nesbot/carbon": "^1.0|^2.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3", - "illuminate/console": "^6|^7|^8.67|^9|^10", - "illuminate/routing": "^6|^7|^8.67|^9|^10", - "orchestra/testbench": "^4.18|^5.8|^6.3|^7|^8", + "illuminate/console": "^6|^7|^8.67|^9|^10|^11", + "illuminate/routing": "^6|^7|^8.67|^9|^10|^11", + "orchestra/testbench": "^4.18|^5.8|^6.3|^7|^8|^9|9.x-dev", "mockery/mockery": "^1.4.4", "phpstan/phpstan": "^1", "phpunit/phpunit": "^8.5|^9.4|^10", @@ -88,7 +88,7 @@ "scripts": { "php-cs-fixer": "php-cs-fixer fix --diff", "test": "phpunit --colors=always", - "test:ci": "composer test -- --verbose --coverage-text --coverage-clover=coverage.xml", + "test:ci": "composer test -- --coverage-text --coverage-clover=coverage.xml", "phpstan": "phpstan analyse --memory-limit=256M", "phpstan-baseline": "phpstan analyse --generate-baseline --memory-limit=256M" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4f7dda60..cd6688ba 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,31 +1,14 @@ - - - src/ - - - src/Providers/LumenServiceProvider.php - src/Facades/ - src/Console/ - @@ -40,4 +23,14 @@ + + + src/ + + + src/Providers/LumenServiceProvider.php + src/Facades/ + src/Console/ + + diff --git a/tests/BlacklistTest.php b/tests/BlacklistTest.php index a178e0eb..76ac86d9 100644 --- a/tests/BlacklistTest.php +++ b/tests/BlacklistTest.php @@ -179,7 +179,7 @@ public function itShouldCheckWhetherATokenHasBeenBlacklisted() $this->assertTrue($this->blacklist->has($payload)); } - public function blacklist_provider() + public static function blacklist_provider() { return [ [null], diff --git a/tests/Http/ParserTest.php b/tests/Http/ParserTest.php index d0b908c1..2a36c9ba 100644 --- a/tests/Http/ParserTest.php +++ b/tests/Http/ParserTest.php @@ -152,7 +152,7 @@ public function itShouldHandleExcessWhitespaceFromTheAuthorizationHeader($whites $this->assertTrue($parser->hasToken()); } - public function whitespaceProvider() + public static function whitespaceProvider() { return [ 'space' => [' '], diff --git a/tests/Middleware/AbstractMiddlewareTest.php b/tests/Middleware/AbstractMiddleware.php similarity index 92% rename from tests/Middleware/AbstractMiddlewareTest.php rename to tests/Middleware/AbstractMiddleware.php index 2e677a99..afa067db 100644 --- a/tests/Middleware/AbstractMiddlewareTest.php +++ b/tests/Middleware/AbstractMiddleware.php @@ -17,7 +17,7 @@ use PHPOpenSourceSaver\JWTAuth\JWTAuth; use PHPOpenSourceSaver\JWTAuth\Test\AbstractTestCase; -abstract class AbstractMiddlewareTest extends AbstractTestCase +abstract class AbstractMiddleware extends AbstractTestCase { /** * @var MockInterface|JWTAuth diff --git a/tests/Middleware/AuthenticateAndRenewTest.php b/tests/Middleware/AuthenticateAndRenewTest.php index d33f202c..33991140 100644 --- a/tests/Middleware/AuthenticateAndRenewTest.php +++ b/tests/Middleware/AuthenticateAndRenewTest.php @@ -20,7 +20,7 @@ use PHPOpenSourceSaver\JWTAuth\Test\Stubs\UserStub; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -class AuthenticateAndRenewTest extends AbstractMiddlewareTest +class AuthenticateAndRenewTest extends AbstractMiddleware { /** * @var Authenticate|AuthenticateAndRenew diff --git a/tests/Middleware/AuthenticateTest.php b/tests/Middleware/AuthenticateTest.php index c8c2c583..016679af 100644 --- a/tests/Middleware/AuthenticateTest.php +++ b/tests/Middleware/AuthenticateTest.php @@ -18,7 +18,7 @@ use PHPOpenSourceSaver\JWTAuth\Test\Stubs\UserStub; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -class AuthenticateTest extends AbstractMiddlewareTest +class AuthenticateTest extends AbstractMiddleware { /** * @var Authenticate diff --git a/tests/Middleware/CheckTest.php b/tests/Middleware/CheckTest.php index 01886b84..e43fa920 100644 --- a/tests/Middleware/CheckTest.php +++ b/tests/Middleware/CheckTest.php @@ -17,7 +17,7 @@ use PHPOpenSourceSaver\JWTAuth\Http\Parser\Parser; use PHPOpenSourceSaver\JWTAuth\Test\Stubs\UserStub; -class CheckTest extends AbstractMiddlewareTest +class CheckTest extends AbstractMiddleware { /** * @var Check diff --git a/tests/Middleware/RefreshTokenTest.php b/tests/Middleware/RefreshTokenTest.php index e4454fc0..38563372 100644 --- a/tests/Middleware/RefreshTokenTest.php +++ b/tests/Middleware/RefreshTokenTest.php @@ -18,7 +18,7 @@ use PHPOpenSourceSaver\JWTAuth\Http\Parser\Parser; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -class RefreshTokenTest extends AbstractMiddlewareTest +class RefreshTokenTest extends AbstractMiddleware { /** * @var RefreshToken diff --git a/tests/Stubs/LaravelUserStub.php b/tests/Stubs/LaravelUserStub.php index 196ca62d..83e25547 100644 --- a/tests/Stubs/LaravelUserStub.php +++ b/tests/Stubs/LaravelUserStub.php @@ -25,6 +25,10 @@ public function getAuthIdentifier() { } + public function getAuthPasswordName() + { + } + public function getAuthPassword() { } diff --git a/tests/Validators/TokenValidatorTest.php b/tests/Validators/TokenValidatorTest.php index 2055bc06..9880c07a 100644 --- a/tests/Validators/TokenValidatorTest.php +++ b/tests/Validators/TokenValidatorTest.php @@ -84,7 +84,7 @@ public function itShouldThrowAnExceptionWhenProvidingAMalformedTokenWithWrongSeg $this->validator->check($token); } - public function dataProviderMalformedTokens() + public static function dataProviderMalformedTokens() { return [ ['one.two.'], @@ -97,7 +97,7 @@ public function dataProviderMalformedTokens() ]; } - public function dataProviderTokensWithWrongSegmentsNumber() + public static function dataProviderTokensWithWrongSegmentsNumber() { return [ ['one.two'],