From c36a698c491a9bd4cc66706195acf9f4ced5aa31 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 17 Jul 2024 10:19:16 +0200 Subject: [PATCH] Add support for Symfony 7 (#35) --- .github/workflows/test-application.yaml | 27 ++++++++++++++----- Tests/Application/bin/console.php | 2 +- .../SetThemeEventListenerTest.php | 3 +++ composer.json | 24 ++++++++++------- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index e8883f2..d2bd1b3 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -41,6 +41,16 @@ jobs: env: SYMFONY_DEPRECATIONS_HELPER: weak + - php-version: '8.2' + dependency-versions: 'highest' + env: + SYMFONY_DEPRECATIONS_HELPER: weak + + - php-version: '8.3' + dependency-versions: 'highest' + env: + SYMFONY_DEPRECATIONS_HELPER: weak + services: mysql: image: mysql:5.7 @@ -52,17 +62,21 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install and configure PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - extensions: 'imagick' tools: 'composer:v2' + - name: Remove Lint Tools + # These tools are not required to run tests, so we are removing them to improve dependency resolving and + # testing lowest versions. + run: composer remove "*php-cs-fixer*" "*phpstan*" "*rector*" --dev --no-update + - name: Install composer dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v2 with: dependency-versions: ${{matrix.dependency-versions}} @@ -80,17 +94,16 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install and configure PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 - extensions: 'imagick' + php-version: 8.3 tools: 'composer:v2' - name: Install composer dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v2 with: dependency-versions: ${{matrix.dependency-versions}} diff --git a/Tests/Application/bin/console.php b/Tests/Application/bin/console.php index 849f2ce..a2df4c0 100644 --- a/Tests/Application/bin/console.php +++ b/Tests/Application/bin/console.php @@ -33,7 +33,7 @@ if (\class_exists(Debug::class)) { Debug::enable(); } else { - \Symfony\Component\Debug\Debug::enable(); + Symfony\Component\Debug\Debug::enable(); } } diff --git a/Tests/Unit/EventListener/SetThemeEventListenerTest.php b/Tests/Unit/EventListener/SetThemeEventListenerTest.php index f676759..f026009 100644 --- a/Tests/Unit/EventListener/SetThemeEventListenerTest.php +++ b/Tests/Unit/EventListener/SetThemeEventListenerTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use Sulu\Bundle\PreviewBundle\Preview\Events\PreRenderEvent; use Sulu\Bundle\ThemeBundle\EventListener\SetThemeEventListener; @@ -29,6 +30,8 @@ class SetThemeEventListenerTest extends TestCase { + use ProphecyTrait; + /** * @var ThemeRepositoryInterface|ObjectProphecy */ diff --git a/composer.json b/composer.json index 0cd5acf..a6cdc07 100644 --- a/composer.json +++ b/composer.json @@ -16,24 +16,25 @@ "require": { "php": "^7.3 || ^8.0", "sulu/sulu": "^2.4 || ^2.5@dev", - "symfony/config": "^4.4 || ^5.4 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "sylius/theme-bundle": "^2.1" + "symfony/config": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "sylius/theme-bundle": "^2.1 || ^2.4@dev" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.1", - "jackalope/jackalope-doctrine-dbal": "^1.3.4", + "jackalope/jackalope-doctrine-dbal": "^1.3.4 || ^2.0", "jangregor/phpstan-prophecy": "^1.0", + "php-cs-fixer/shim": "^3.1", "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", "phpstan/phpstan": "^1.4", "phpstan/phpstan-doctrine": "^1.2", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.1", - "phpunit/phpunit": "^8.5.9", - "symfony/dotenv": "^5.4 || ^6.0", + "phpunit/phpunit": "^8.5.9 || ^9.5", + "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", - "symfony/phpunit-bridge": "^5.2", + "symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0", "thecodingmachine/phpstan-strict-rules": "^1.0" }, "conflict": { @@ -87,6 +88,9 @@ ] }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "php-http/discovery": true + } } }