Skip to content

Commit 7217125

Browse files
committed
minor #3192 Tests on Symfony 8 stable (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- Tests on Symfony 8 stable | Q | A | -------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Documentation? | no <!-- required for new features, or documentation updates --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> The following jobs are still impossible to make them green for the following reasons: - Functional Tests / turbo-tests (8.4, stable): waiting for symfony/panther#678 - Functional Tests / turbo-tests (8.5, stable): sam as above - Functional Tests / turbo-tests (dev, 8.5): same as above - Unit Tests / php (8.4, 8.0.*) : waiting for some `zenstruck/*` packages to be compatible with Symfony 8, and `spatie/phpunit-snapshot-assertions` (but couldn't be installed unless we require PHPUnit 10) - Unit Tests / php (8.5, 8.0.*) : same as above Commits ------- 724429c Tests on Symfony 8 stable
2 parents 27bf7f8 + 724429c commit 7217125

File tree

8 files changed

+59
-33
lines changed

8 files changed

+59
-33
lines changed

.github/workflows/.utils.sh

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,29 @@ _run_task() {
2929
}
3030
export -f _run_task
3131

32-
install_property_info_for_version() {
33-
local php_version="$1"
34-
local min_stability="$2"
32+
# Install specific versions of PropertyInfo and TypeInfo based on PHP and Symfony versions
33+
# To remove in Symfony UX 4.0
34+
live_component_post_install() {
35+
local php_version=$1
3536

36-
if [ "$php_version" = "8.2" ]; then
37-
composer require symfony/property-info:7.1.* symfony/type-info:7.2.*
38-
elif [ "$php_version" = "8.3" ]; then
39-
composer require symfony/property-info:7.2.* symfony/type-info:7.2.*
40-
elif [ "$php_version" = "8.4" ] && [ "$min_stability" = "stable" ]; then
41-
composer require symfony/property-info:7.3.* symfony/type-info:7.3.*
42-
elif [ "$php_version" = "8.4" ] && [ "$min_stability" = "dev" ]; then
43-
composer require symfony/property-info:>=7.3 symfony/type-info:>=7.3
44-
fi
37+
case "$php_version" in
38+
8.1)
39+
# no-op, let Composer install the best PropertyInfo version (defined in composer.json), but do not require TypeInfo
40+
return 0
41+
;;
42+
8.2)
43+
# PropertyInfo 7.1 (experimental PropertyTypeExtractorInterface::getType) and TypeInfo 7.2 (lowest non-experimental)
44+
composer require symfony/property-info:7.1.* symfony/type-info:7.2.*
45+
return $?
46+
;;
47+
8.3)
48+
# Install PropertyInfo 7.3 (deprecate PropertyTypeExtractorInterface::getTypes) and TypeInfo 7.3 (new features and deprecations)
49+
composer require symfony/property-info:7.3.* symfony/type-info:7.3.*
50+
return $?
51+
;;
52+
esac
53+
54+
# Install the best TypeInfo version available
55+
composer require symfony/type-info
4556
}
46-
export -f install_property_info_for_version
57+
export -f live_component_post_install

.github/workflows/unit-tests.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,29 @@ jobs:
3636
include:
3737
- minimum-stability: 'dev'
3838
php-version: '8.5'
39+
3940
# lowest deps
4041
- php-version: '8.1'
4142
dependency-version: 'lowest'
43+
4244
# LTS version of Symfony
4345
- php-version: '8.1'
4446
symfony-version: '6.4.*'
4547
- php-version: '8.1'
4648
symfony-version: '6.4.*'
4749
os: 'windows-latest'
48-
# Explicit Symfony versions
50+
4951
- php-version: '8.2'
50-
symfony-version: '^7.4.0-RC1' # TODO: change to '7.4.*' when Symfony 7.4 is released
51-
minimum-stability: 'RC'
52+
symfony-version: '7.4.*'
53+
- php-version: '8.2'
54+
symfony-version: '7.4.*'
55+
os: 'windows-latest'
56+
57+
# Explicit Symfony versions
5258
- php-version: '8.4'
53-
symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released
54-
minimum-stability: 'RC'
59+
symfony-version: '8.0.*'
5560
- php-version: '8.5'
56-
symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released
57-
minimum-stability: 'RC'
61+
symfony-version: '8.0.*'
5862

5963
env:
6064
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=5.4' }} # TODO: To change to '>=6.4' in 3.x
@@ -87,7 +91,7 @@ jobs:
8791
uses: shivammathur/setup-php@v2
8892
with:
8993
php-version: ${{ matrix.php-version }}
90-
extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd' || '' }}
94+
extensions: ${{ matrix.os == 'windows-latest' && 'pdo_sqlite,sqlite3,fileinfo,gd,zip' || '' }}
9195
tools: flex
9296

9397
- name: Get composer cache directory
@@ -119,7 +123,7 @@ jobs:
119123
'(cd src/{} \
120124
&& $COMPOSER_MIN_STAB \
121125
&& $COMPOSER_UP \
122-
&& if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
126+
&& if [ {} = LiveComponent ]; then live_component_post_install \"${{ matrix.php-version }}\"; fi \
123127
&& $PHPUNIT)'"
124128
125129
- name: Run packages tests (Windows)
@@ -134,7 +138,7 @@ jobs:
134138
'(cd src/$PACKAGE \
135139
&& $COMPOSER_MIN_STAB \
136140
&& $COMPOSER_UP \
137-
&& if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
141+
&& if [ "$PACKAGE" = "LiveComponent" ]; then live_component_post_install ${{ matrix.php-version }}; fi \
138142
&& $PHPUNIT)'; then
139143
FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
140144
fi

src/Autocomplete/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"doctrine/collections": "^1.6.8|^2.0",
36-
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
36+
"doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0",
3737
"doctrine/orm": "^2.9.4|^3.0",
3838
"fakerphp/faker": "^1.22",
3939
"mtdowling/jmespath.php": "^2.6",

src/Autocomplete/tests/Fixtures/Kernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ protected function configureContainer(ContainerConfigurator $c): void
138138
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true;
139139
}
140140
}
141-
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
141+
142+
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) {
142143
$doctrineConfig['orm']['enable_native_lazy_objects'] = true;
143144
}
144145
}

src/LiveComponent/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"require-dev": {
3838
"doctrine/annotations": "^1.0|^2.0",
3939
"doctrine/collections": "^1.6.8|^2.0",
40-
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
40+
"doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0",
4141
"doctrine/orm": "^2.9.4|^3.0",
42-
"doctrine/persistence": "^2.5.2|^3.0",
42+
"doctrine/persistence": "^2.5.2|^3.0|^4.0",
4343
"phpdocumentor/reflection-docblock": "5.x-dev",
4444
"symfony/dependency-injection": "^5.4|^6.0|^7.0|^8.0",
4545
"symfony/expression-language": "^5.4|^6.0|^7.0|^8.0",

src/LiveComponent/tests/Fixtures/Kernel.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Composer\InstalledVersions;
1515
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
16-
use Doctrine\ORM\Mapping\AssociationMapping;
1716
use Psr\Log\NullLogger;
1817
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
1918
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
@@ -81,7 +80,7 @@ public function registerBundles(): iterable
8180
protected function build(ContainerBuilder $container): void
8281
{
8382
// workaround https://github.com/symfony/symfony/issues/50322
84-
$container->addCompilerPass(new class() implements CompilerPassInterface {
83+
$container->addCompilerPass(new class implements CompilerPassInterface {
8584
public function process(ContainerBuilder $container): void
8685
{
8786
$container->removeDefinition('doctrine.orm.listeners.pdo_session_handler_schema_listener');
@@ -190,18 +189,29 @@ protected function configureContainer(ContainerConfigurator $c): void
190189
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
191190
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
192191
}
192+
193+
// https://github.com/doctrine/DoctrineBundle/pull/1661
194+
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
195+
$doctrineConfig['orm']['report_fields_where_declared'] = true;
196+
}
197+
193198
if (version_compare($doctrineBundleVersion, '2.12.0', '>=')) {
194199
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = false;
195200
}
196201
}
197202

198203
// https://github.com/doctrine/DoctrineBundle/pull/1661
199204
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
200-
$doctrineConfig['orm']['report_fields_where_declared'] = true;
201205
$doctrineConfig['orm']['validate_xml_mapping'] = true;
202206
$doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory';
207+
208+
// https://github.com/doctrine/DoctrineBundle/pull/1962
209+
if (version_compare($doctrineBundleVersion, '3.0.0', '<')) {
210+
$doctrineConfig['orm']['report_fields_where_declared'] = true;
211+
}
203212
}
204-
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
213+
214+
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) {
205215
$doctrineConfig['orm']['enable_native_lazy_objects'] = true;
206216
}
207217
}

src/Turbo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"symfony/stimulus-bundle": "^2.9.1"
3939
},
4040
"require-dev": {
41-
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
41+
"doctrine/doctrine-bundle": "^2.4.3|^3.0|^4.0",
4242
"doctrine/orm": "^2.8|^3.0",
4343
"phpstan/phpstan": "^2.1.17",
4444
"symfony/asset-mapper": "^6.4|^7.0|^8.0",

src/Turbo/tests/app/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function configureContainer(ContainerConfigurator $container): void
111111
}
112112
}
113113

114-
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
114+
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '4.0.0', '<')) {
115115
$doctrineConfig['orm']['enable_native_lazy_objects'] = true;
116116
}
117117
}

0 commit comments

Comments
 (0)