From dbe78611b7f1b91c364c661b1478971b02fc8ad1 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Mon, 13 Nov 2023 12:32:18 -0500 Subject: [PATCH] Fix SF 7 compat --- .github/workflows/run-tests.yml | 18 ++++++++++++++---- ...AttachRefreshTokenOnSuccessListenerTest.php | 4 ++++ composer.json | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 702ce63b..d7e25b59 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: php: ['7.4', '8.0', '8.1', '8.2'] - symfony: ['4.4.*', '5.4.*', '6.0.*', '6.1.*', '6.2.*', '6.3.*'] + symfony: ['4.4.*', '5.4.*', '6.0.*', '6.1.*', '6.2.*', '6.3.*', '6.4.*', '7.0.*'] composer-flags: ['--prefer-stable'] can-fail: [false] extensions: ['curl, iconv, mbstring, mongodb, pdo, pdo_sqlite, sqlite, zip'] @@ -29,18 +29,28 @@ jobs: symfony: '6.2.*' - php: '7.4' symfony: '6.3.*' + - php: '7.4' + symfony: '6.4.*' + - php: '7.4' + symfony: '7.0.*' - php: '8.0' symfony: '6.1.*' - php: '8.0' symfony: '6.2.*' - php: '8.0' symfony: '6.3.*' + - php: '8.0' + symfony: '6.4.*' + - php: '8.0' + symfony: '7.0.*' + - php: '8.1' + symfony: '7.0.*' name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}" steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache dependencies uses: actions/cache@v3 @@ -63,8 +73,8 @@ jobs: version: '5.0' topology: server - - name: Remove Guard - if: contains(fromJSON('["6.0.*", "6.1.*", "6.2.*", "6.3.*"]'), matrix.symfony) + - name: Remove Guard (Symfony >=6.0) + if: contains(fromJSON('["6.0.*", "6.1.*", "6.2.*", "6.3.*", "6.4.*", "7.0.*"]'), matrix.symfony) run: composer remove --dev --no-update symfony/security-guard - name: Install dependencies diff --git a/Tests/Unit/EventListener/AttachRefreshTokenOnSuccessListenerTest.php b/Tests/Unit/EventListener/AttachRefreshTokenOnSuccessListenerTest.php index a71e15f9..7b8e898d 100644 --- a/Tests/Unit/EventListener/AttachRefreshTokenOnSuccessListenerTest.php +++ b/Tests/Unit/EventListener/AttachRefreshTokenOnSuccessListenerTest.php @@ -298,6 +298,10 @@ public function testAttachesTheTokenToTheResponseBodyOnCredentialsAuth() public function testDoesNothingWhenThereIsNotAUser() { + if ((new \ReflectionClass(AuthenticationSuccessEvent::class))->getMethod('getUser')->hasReturnType()) { + $this->markTestSkipped(sprintf('%s::getUser() has a non-nullable return type in LexikJWTAuthenticationBundle 3.x', AuthenticationSuccessEvent::class)); + } + /** @var AuthenticationSuccessEvent|MockObject $event */ $event = $this->createMock(AuthenticationSuccessEvent::class); diff --git a/composer.json b/composer.json index 258beeba..141d9b03 100644 --- a/composer.json +++ b/composer.json @@ -34,11 +34,11 @@ "doctrine/cache": "^1.11|^2.0", "doctrine/mongodb-odm": "^2.2", "doctrine/orm": "^2.7", - "matthiasnoback/symfony-config-test": "^4.2", - "matthiasnoback/symfony-dependency-injection-test": "^4.2", + "matthiasnoback/symfony-config-test": "^4.2|^5.0", + "matthiasnoback/symfony-dependency-injection-test": "^4.2|^5.0", "phpunit/phpunit": "^9.5", "symfony/cache": "^4.4|^5.4|^6.0|^7.0", - "symfony/security-guard": "^4.4|^5.4|^6.0|^7.0" + "symfony/security-guard": "^4.4|^5.4" }, "conflict": { "doctrine/mongodb-odm": "<2.2",