From 724429c023fc5b926344c3c63215d5186e84f609 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Thu, 27 Nov 2025 14:49:11 +0100 Subject: [PATCH] Tests on Symfony 8 stable --- .github/workflows/.utils.sh | 37 +++++++++++++-------- .github/workflows/unit-tests.yaml | 24 +++++++------ src/Autocomplete/composer.json | 2 +- src/Autocomplete/tests/Fixtures/Kernel.php | 3 +- src/LiveComponent/composer.json | 4 +-- src/LiveComponent/tests/Fixtures/Kernel.php | 18 +++++++--- src/Turbo/composer.json | 2 +- src/Turbo/tests/app/Kernel.php | 2 +- 8 files changed, 59 insertions(+), 33 deletions(-) diff --git a/.github/workflows/.utils.sh b/.github/workflows/.utils.sh index 582a3bc7bd2..f97832a10ad 100644 --- a/.github/workflows/.utils.sh +++ b/.github/workflows/.utils.sh @@ -29,18 +29,29 @@ _run_task() { } export -f _run_task -install_property_info_for_version() { - local php_version="$1" - local min_stability="$2" +# Install specific versions of PropertyInfo and TypeInfo based on PHP and Symfony versions +# To remove in Symfony UX 4.0 +live_component_post_install() { + local php_version=$1 - if [ "$php_version" = "8.2" ]; then - composer require symfony/property-info:7.1.* symfony/type-info:7.2.* - elif [ "$php_version" = "8.3" ]; then - composer require symfony/property-info:7.2.* symfony/type-info:7.2.* - elif [ "$php_version" = "8.4" ] && [ "$min_stability" = "stable" ]; then - composer require symfony/property-info:7.3.* symfony/type-info:7.3.* - elif [ "$php_version" = "8.4" ] && [ "$min_stability" = "dev" ]; then - composer require symfony/property-info:>=7.3 symfony/type-info:>=7.3 - fi + case "$php_version" in + 8.1) + # no-op, let Composer install the best PropertyInfo version (defined in composer.json), but do not require TypeInfo + return 0 + ;; + 8.2) + # PropertyInfo 7.1 (experimental PropertyTypeExtractorInterface::getType) and TypeInfo 7.2 (lowest non-experimental) + composer require symfony/property-info:7.1.* symfony/type-info:7.2.* + return $? + ;; + 8.3) + # Install PropertyInfo 7.3 (deprecate PropertyTypeExtractorInterface::getTypes) and TypeInfo 7.3 (new features and deprecations) + composer require symfony/property-info:7.3.* symfony/type-info:7.3.* + return $? + ;; + esac + + # Install the best TypeInfo version available + composer require symfony/type-info } -export -f install_property_info_for_version +export -f live_component_post_install diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index fdfb40cce0f..5a4adea6b7e 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -36,25 +36,29 @@ jobs: include: - minimum-stability: 'dev' php-version: '8.5' + # lowest deps - php-version: '8.1' dependency-version: 'lowest' + # LTS version of Symfony - php-version: '8.1' symfony-version: '6.4.*' - php-version: '8.1' symfony-version: '6.4.*' os: 'windows-latest' - # Explicit Symfony versions + - php-version: '8.2' - symfony-version: '^7.4.0-RC1' # TODO: change to '7.4.*' when Symfony 7.4 is released - minimum-stability: 'RC' + symfony-version: '7.4.*' + - php-version: '8.2' + symfony-version: '7.4.*' + os: 'windows-latest' + + # Explicit Symfony versions - php-version: '8.4' - symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released - minimum-stability: 'RC' + symfony-version: '8.0.*' - php-version: '8.5' - symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released - minimum-stability: 'RC' + symfony-version: '8.0.*' env: SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }} # TODO: To change to '>=6.4' in 3.x @@ -87,7 +91,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd' || '' }} + extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd,zip' || '' }} tools: flex - name: Get composer cache directory @@ -119,7 +123,7 @@ jobs: '(cd src/{} \ && $COMPOSER_MIN_STAB \ && $COMPOSER_UP \ - && if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \ + && if [ {} = LiveComponent ]; then live_component_post_install \"${{ matrix.php-version }}\"; fi \ && $PHPUNIT)'" - name: Run packages tests (Windows) @@ -134,7 +138,7 @@ jobs: '(cd src/$PACKAGE \ && $COMPOSER_MIN_STAB \ && $COMPOSER_UP \ - && if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \ + && if [ "$PACKAGE" = "LiveComponent" ]; then live_component_post_install ${{ matrix.php-version }}; fi \ && $PHPUNIT)'; then FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE" fi diff --git a/src/Autocomplete/composer.json b/src/Autocomplete/composer.json index 70607dbcb61..a1a05cfbf5d 100644 --- a/src/Autocomplete/composer.json +++ b/src/Autocomplete/composer.json @@ -33,7 +33,7 @@ }, "require-dev": { "doctrine/collections": "^1.6.8|^2.0", - "doctrine/doctrine-bundle": "^2.4.3|^3.0.0", + "doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0", "doctrine/orm": "^2.9.4|^3.0", "fakerphp/faker": "^1.22", "mtdowling/jmespath.php": "^2.6", diff --git a/src/Autocomplete/tests/Fixtures/Kernel.php b/src/Autocomplete/tests/Fixtures/Kernel.php index c2620d64844..d127e641bb2 100644 --- a/src/Autocomplete/tests/Fixtures/Kernel.php +++ b/src/Autocomplete/tests/Fixtures/Kernel.php @@ -138,7 +138,8 @@ protected function configureContainer(ContainerConfigurator $c): void $doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true; } } - if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) { + + if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) { $doctrineConfig['orm']['enable_native_lazy_objects'] = true; } } diff --git a/src/LiveComponent/composer.json b/src/LiveComponent/composer.json index dae4043ade1..44b21045da4 100644 --- a/src/LiveComponent/composer.json +++ b/src/LiveComponent/composer.json @@ -37,9 +37,9 @@ "require-dev": { "doctrine/annotations": "^1.0|^2.0", "doctrine/collections": "^1.6.8|^2.0", - "doctrine/doctrine-bundle": "^2.4.3|^3.0.0", + "doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0", "doctrine/orm": "^2.9.4|^3.0", - "doctrine/persistence": "^2.5.2|^3.0", + "doctrine/persistence": "^2.5.2|^3.0|^4.0", "phpdocumentor/reflection-docblock": "5.x-dev", "symfony/dependency-injection": "^5.4|^6.0|^7.0|^8.0", "symfony/expression-language": "^5.4|^6.0|^7.0|^8.0", diff --git a/src/LiveComponent/tests/Fixtures/Kernel.php b/src/LiveComponent/tests/Fixtures/Kernel.php index bff09b00329..b6ced22419d 100644 --- a/src/LiveComponent/tests/Fixtures/Kernel.php +++ b/src/LiveComponent/tests/Fixtures/Kernel.php @@ -13,7 +13,6 @@ use Composer\InstalledVersions; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; -use Doctrine\ORM\Mapping\AssociationMapping; use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; @@ -81,7 +80,7 @@ public function registerBundles(): iterable protected function build(ContainerBuilder $container): void { // workaround https://github.com/symfony/symfony/issues/50322 - $container->addCompilerPass(new class() implements CompilerPassInterface { + $container->addCompilerPass(new class implements CompilerPassInterface { public function process(ContainerBuilder $container): void { $container->removeDefinition('doctrine.orm.listeners.pdo_session_handler_schema_listener'); @@ -190,6 +189,12 @@ protected function configureContainer(ContainerConfigurator $c): void if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) { $doctrineConfig['orm']['enable_lazy_ghost_objects'] = true; } + + // https://github.com/doctrine/DoctrineBundle/pull/1661 + if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) { + $doctrineConfig['orm']['report_fields_where_declared'] = true; + } + if (version_compare($doctrineBundleVersion, '2.12.0', '>=')) { $doctrineConfig['orm']['controller_resolver']['auto_mapping'] = false; } @@ -197,11 +202,16 @@ protected function configureContainer(ContainerConfigurator $c): void // https://github.com/doctrine/DoctrineBundle/pull/1661 if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) { - $doctrineConfig['orm']['report_fields_where_declared'] = true; $doctrineConfig['orm']['validate_xml_mapping'] = true; $doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory'; + + // https://github.com/doctrine/DoctrineBundle/pull/1962 + if (version_compare($doctrineBundleVersion, '3.0.0', '<')) { + $doctrineConfig['orm']['report_fields_where_declared'] = true; + } } - if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) { + + if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) { $doctrineConfig['orm']['enable_native_lazy_objects'] = true; } } diff --git a/src/Turbo/composer.json b/src/Turbo/composer.json index 6093f2bf3f4..09e3deea908 100644 --- a/src/Turbo/composer.json +++ b/src/Turbo/composer.json @@ -38,7 +38,7 @@ "symfony/stimulus-bundle": "^2.9.1" }, "require-dev": { - "doctrine/doctrine-bundle": "^2.4.3|^3.0.0", + "doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0", "doctrine/orm": "^2.8|^3.0", "phpstan/phpstan": "^2.1.17", "symfony/asset-mapper": "^6.4|^7.0|^8.0", diff --git a/src/Turbo/tests/app/Kernel.php b/src/Turbo/tests/app/Kernel.php index 505112937cd..05f5be95741 100644 --- a/src/Turbo/tests/app/Kernel.php +++ b/src/Turbo/tests/app/Kernel.php @@ -111,7 +111,7 @@ protected function configureContainer(ContainerConfigurator $container): void } } - if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) { + if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) { $doctrineConfig['orm']['enable_native_lazy_objects'] = true; } }