-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
run tests using PHPUnit 11.5 #58370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run tests using PHPUnit 11.5 #58370
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,7 +75,7 @@ jobs: | |
| ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" | ||
|
|
||
| echo COLUMNS=120 >> $GITHUB_ENV | ||
| echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration,transient" >> $GITHUB_ENV | ||
| echo PHPUNIT="$(pwd)/phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group integration --exclude-group transient" >> $GITHUB_ENV | ||
| echo COMPOSER_UP='composer update --no-progress --ansi'$([[ "${{ matrix.mode }}" != low-deps ]] && echo ' --ignore-platform-req=php+') >> $GITHUB_ENV | ||
|
|
||
| SYMFONY_VERSIONS=$(git ls-remote -q --heads | cut -f2 | grep -o '/[1-9][0-9]*\.[0-9].*' | sort -V) | ||
|
|
@@ -131,7 +131,7 @@ jobs: | |
| fi | ||
|
|
||
| # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one | ||
| [[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=,legacy >> $GITHUB_ENV || true | ||
| [[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=" --exclude-group legacy" >> $GITHUB_ENV || true | ||
|
|
||
| echo SYMFONY_VERSION=$SYMFONY_VERSION >> $GITHUB_ENV | ||
| echo COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev >> $GITHUB_ENV | ||
|
|
@@ -197,13 +197,13 @@ jobs: | |
| fi | ||
|
|
||
| if [[ "${{ matrix.mode }}" = low-deps ]]; then | ||
| echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" | ||
| echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT --do-not-fail-on-deprecation'" | ||
|
|
||
| exit 0 | ||
| fi | ||
|
|
||
| # matrix.mode = high-deps | ||
| echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 | ||
| echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY --do-not-fail-on-deprecation'" || X=1 | ||
|
|
||
| # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) | ||
| PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true) | ||
|
|
@@ -222,7 +222,7 @@ jobs: | |
| echo "::group::install phpunit" | ||
| ./phpunit install | ||
| echo "::endgroup::" | ||
| echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 | ||
| echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT --exclude-group tty,benchmark,intl-data,integration,transient,legacy'" || X=1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no repeated
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this job uses the PhpUnitBridge from the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which also means that we need to update this line for the 8.x lifecycle after merging up |
||
| fi | ||
| fi | ||
|
|
||
|
|
@@ -250,12 +250,12 @@ jobs: | |
|
|
||
| mkdir -p /opt/php/lib | ||
| echo memory_limit=-1 > /opt/php/lib/php.ini | ||
| ./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process | ||
| ./phpunit install | ||
| ./build/php/bin/php ./phpunit src/Symfony/Component/Process | ||
|
|
||
| - name: Run PhpUnitBridge tests with PHPUnit 11 | ||
| - name: Run PhpUnitBridge tests with PHPUnit 9.6 | ||
| if: '! matrix.mode' | ||
| run: | | ||
| ./phpunit src/Symfony/Bridge/PhpUnit | ||
| env: | ||
| SYMFONY_PHPUNIT_VERSION: '11.3' | ||
| SYMFONY_DEPRECATIONS_HELPER: 'disabled' | ||
| SYMFONY_PHPUNIT_VERSION: '9.6' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| windows: | ||
| windows-minimal-exts: | ||
| name: x86 / minimal-exts / lowest-php | ||
|
|
||
| defaults: | ||
|
|
@@ -23,7 +23,83 @@ jobs: | |
|
|
||
| env: | ||
| COMPOSER_NO_INTERACTION: '1' | ||
| SYMFONY_DEPRECATIONS_HELPER: 'strict' | ||
| ANSICON: '121x90 (121x90)' | ||
| SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1' | ||
|
|
||
| steps: | ||
| - name: Setup Git | ||
| run: | | ||
| git config --global core.autocrlf false | ||
| git config --global user.email "" | ||
| git config --global user.name "Symfony" | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Setup PHP | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
| mkdir c:\php && cd c:\php | ||
| iwr -outf php.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.2.0-Win32-vs16-x86.zip | ||
| 7z x php.zip -y >nul | ||
| Copy php.ini-development php.ini | ||
| "memory_limit=-1" >> php.ini | ||
| "serialize_precision=-1" >> php.ini | ||
| "max_execution_time=1200" >> php.ini | ||
| "post_max_size=2047M" >> php.ini | ||
| "upload_max_filesize=2047M" >> php.ini | ||
| "date.timezone=`"America/Los_Angeles`"" >> php.ini | ||
| "extension_dir=ext" >> php.ini | ||
| "extension=php_xsl.dll" >> php.ini | ||
| "extension=php_mbstring.dll" >> php.ini | ||
| "extension=php_openssl.dll" >> php.ini | ||
| cd ${{ github.workspace }} | ||
| iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar | ||
|
|
||
| - name: Install dependencies | ||
| id: setup | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
| mkdir $env:APPDATA\Composer && Copy .github\composer-config.json $env:APPDATA\Composer\config.json | ||
|
|
||
| $env:SYMFONY_VERSION=(Select-String -CaseSensitive -Pattern " VERSION =" -SimpleMatch -Path src/Symfony/Component/HttpKernel/Kernel.php | Select Line | Select-String -Pattern "([0-9][0-9]*\.[0-9])").Matches.Value | ||
| $env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev" | ||
|
|
||
| php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit | ||
| php composer.phar update --no-progress --ansi | ||
|
|
||
| - name: Install PHPUnit | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
|
|
||
| php phpunit install | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
| $x = 0 | ||
|
|
||
| Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse | ||
| mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml | ||
| php phpunit src\Symfony --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows || ($x = 1) | ||
| # HttpClient tests need to run separately, they block when run with other components' tests concurrently | ||
| php phpunit src\Symfony\Component\HttpClient || ($x = 1) | ||
|
|
||
| exit $x | ||
|
|
||
| windows-all-extensions: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make things easier to maintain, would it be worth backporting this split of the Windows jobs ? what do you think @nicolas-grekas ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we talked about that in #58721 but decided to not split the two test runs as we would otherwise run many of the tests twice since the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any discussion about that in the PR you linked
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm, maybe @nicolas-grekas and me talked about that on Slack directly 🤔 |
||
| name: x86 / all extensions / lowest-php | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: pwsh | ||
|
|
||
| runs-on: windows-2022 | ||
|
|
||
| env: | ||
| COMPOSER_NO_INTERACTION: '1' | ||
| ANSICON: '121x90 (121x90)' | ||
| SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1' | ||
|
|
||
|
|
@@ -53,30 +129,28 @@ jobs: | |
| iwr -outf php_redis.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.2.0-8.2-ts-vs16-x86.zip | ||
| 7z x php_redis.zip -y >nul | ||
| cd .. | ||
| Copy php.ini-development php.ini-min | ||
| "memory_limit=-1" >> php.ini-min | ||
| "serialize_precision=-1" >> php.ini-min | ||
| "max_execution_time=1200" >> php.ini-min | ||
| "post_max_size=2047M" >> php.ini-min | ||
| "upload_max_filesize=2047M" >> php.ini-min | ||
| "date.timezone=`"America/Los_Angeles`"" >> php.ini-min | ||
| "extension_dir=ext" >> php.ini-min | ||
| "extension=php_xsl.dll" >> php.ini-min | ||
| "extension=php_mbstring.dll" >> php.ini-min | ||
| Copy php.ini-min php.ini-max | ||
| "zend_extension=php_opcache.dll" >> php.ini-max | ||
| "opcache.enable_cli=1" >> php.ini-max | ||
| "extension=php_openssl.dll" >> php.ini-max | ||
| "extension=php_apcu.dll" >> php.ini-max | ||
| "extension=php_igbinary.dll" >> php.ini-max | ||
| "extension=php_redis.dll" >> php.ini-max | ||
| "apc.enable_cli=1" >> php.ini-max | ||
| "extension=php_intl.dll" >> php.ini-max | ||
| "extension=php_fileinfo.dll" >> php.ini-max | ||
| "extension=php_pdo_sqlite.dll" >> php.ini-max | ||
| "extension=php_curl.dll" >> php.ini-max | ||
| "extension=php_sodium.dll" >> php.ini-max | ||
| Copy php.ini-max php.ini | ||
| Copy php.ini-development php.ini | ||
| "memory_limit=-1" >> php.ini | ||
| "serialize_precision=-1" >> php.ini | ||
| "max_execution_time=1200" >> php.ini | ||
| "post_max_size=2047M" >> php.ini | ||
| "upload_max_filesize=2047M" >> php.ini | ||
| "date.timezone=`"America/Los_Angeles`"" >> php.ini | ||
| "extension_dir=ext" >> php.ini | ||
| "extension=php_xsl.dll" >> php.ini | ||
| "extension=php_mbstring.dll" >> php.ini | ||
| "zend_extension=php_opcache.dll" >> php.ini | ||
| "opcache.enable_cli=1" >> php.ini | ||
| "extension=php_openssl.dll" >> php.ini | ||
| "extension=php_apcu.dll" >> php.ini | ||
| "extension=php_igbinary.dll" >> php.ini | ||
| "extension=php_redis.dll" >> php.ini | ||
| "apc.enable_cli=1" >> php.ini | ||
| "extension=php_intl.dll" >> php.ini | ||
| "extension=php_fileinfo.dll" >> php.ini | ||
| "extension=php_pdo_sqlite.dll" >> php.ini | ||
| "extension=php_curl.dll" >> php.ini | ||
| "extension=php_sodium.dll" >> php.ini | ||
| cd ${{ github.workspace }} | ||
| iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar | ||
|
|
||
|
|
@@ -102,32 +176,13 @@ jobs: | |
| run: | | ||
| choco install --no-progress memurai-developer | ||
|
|
||
| - name: Run tests (minimal extensions) | ||
| if: always() && steps.setup.outcome == 'success' | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
| $env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped' | ||
| $x = 0 | ||
|
|
||
| Copy c:\php\php.ini-min c:\php\php.ini | ||
| Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse | ||
| mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml | ||
| php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1) | ||
| # HttpClient tests need to run separately, they block when run with other components' tests concurrently | ||
| php phpunit src\Symfony\Component\HttpClient || ($x = 1) | ||
|
|
||
| exit $x | ||
|
|
||
| - name: Run tests | ||
| if: always() && steps.setup.outcome == 'success' | ||
| run: | | ||
| $env:Path = 'c:\php;' + $env:Path | ||
| $env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped' | ||
| $x = 0 | ||
|
|
||
| Copy c:\php\php.ini-max c:\php\php.ini | ||
| php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1) | ||
| php phpunit src\Symfony --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows --requires-php-extension apcu --requires-php-extension curl --requires-php-extension fileinfo --requires-php-extension igbinary --requires-php-extension intl --requires-php-extension openssl --requires-php-extension pdo_sqlite --requires-php-extension redis --requires-php-extension sodium || ($x = 1) | ||
| # HttpClient tests need to run separately, they block when run with other components' tests concurrently | ||
| php phpunit src\Symfony\Component\HttpClient || ($x = 1) | ||
| php phpunit src\Symfony\Component\HttpClient --requires-php-extension curl --requires-php-extension openssl || ($x = 1) | ||
|
|
||
| exit $x | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |||||
| use Doctrine\Persistence\Mapping\ClassMetadata; | ||||||
| use Doctrine\Persistence\ObjectManager; | ||||||
| use Doctrine\Persistence\ObjectRepository; | ||||||
| use PHPUnit\Framework\Attributes\Group; | ||||||
| use PHPUnit\Framework\Attributes\IgnoreDeprecations; | ||||||
| use PHPUnit\Framework\MockObject\MockObject; | ||||||
| use PHPUnit\Framework\TestCase; | ||||||
| use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver; | ||||||
|
|
@@ -64,9 +66,8 @@ public function testResolveWithoutManager() | |||||
| $this->assertSame([], $resolver->resolve($request, $argument)); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @group legacy | ||||||
| */ | ||||||
| #[IgnoreDeprecations] | ||||||
| #[Group('legacy')] | ||||||
| public function testResolveWithNoIdAndDataOptional() | ||||||
| { | ||||||
| $manager = $this->createMock(ObjectManager::class); | ||||||
|
|
@@ -251,9 +252,8 @@ public static function idsProvider(): iterable | |||||
| yield ['foo']; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @group legacy | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we keep a symfony/.github/workflows/unit-tests.yml Lines 134 to 135 in fe94cfb
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thinking about this again, I think this option was overkill and was leading to not testing some parts of the code in CI in our LTS branches. Many legacy tests we have are about testing deprecations of their own component, which does not need such exclusion. Tests relying on cross-package deprecations could be responsible for skipping themselves when needed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to make a decision here. There’s two options:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest updating the test in 6.4 to skip them when they rely on cross-package deprecated APIs and the other component is installed in a version with the BC layer removed. Skipping all legacy tests skips much more tests than necessary. Most of our legacy tests are about testing the BC layer of the package itself.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was chatting with @xabbuh about this yesterday and I think it'd be better to keep the existing policy of always using the legacy group when also skipping the deprecations. This worked really nice for years, and the code that is "overskipped" is still run on other matric lines, so the coverage it still as good as desired. |
||||||
| */ | ||||||
| #[IgnoreDeprecations] | ||||||
| #[Group('legacy')] | ||||||
| public function testResolveGuessOptional() | ||||||
| { | ||||||
| $manager = $this->createMock(ObjectManager::class); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be removed ? You removed the
legacygroup so this will probably not work anymore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. For now this would work as the group is present in the
6.4branch (see also #58370 (comment)). We need to decide which approach we do want to take.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see also #58370 (comment)