Skip to content

Commit 53e759a

Browse files
minor symfony#58370 run tests using PHPUnit 11.5 (xabbuh)
This PR was merged into the 7.4 branch. Discussion ---------- run tests using PHPUnit 11.5 | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 652ba2e run tests using PHPUnit 11.5
2 parents 39c5025 + 652ba2e commit 53e759a

File tree

318 files changed

+2952
-2263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+2952
-2263
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ jobs:
251251
git diff --exit-code src/ || (echo '::error::Run "php .github/sync-translations.php" to fix XLIFF files.' && exit 1)
252252
253253
- name: Run tests
254-
run: ./phpunit --group integration -v
254+
run: ./phpunit --group integration
255255
env:
256256
INTEGRATION_FTP_URL: 'ftp://test:test@localhost'
257257
REDIS_HOST: 'localhost:16379'

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
4444
export COMPOSER_ROOT_VERSION=$(grep ' VERSION = ' src/Symfony/Component/HttpKernel/Kernel.php | grep -P -o '[0-9]+\.[0-9]+').x-dev
4545
composer remove --dev --no-update --no-interaction symfony/phpunit-bridge
46-
composer require --no-progress --ansi --no-plugins psalm/phar:@stable phpunit/phpunit:^9.6 php-http/discovery psr/event-dispatcher mongodb/mongodb jetbrains/phpstorm-stubs
46+
composer require --no-progress --ansi --no-plugins psalm/phar:@stable phpunit/phpunit:^11.5 php-http/discovery psr/event-dispatcher mongodb/mongodb jetbrains/phpstorm-stubs
4747
4848
- name: Generate Psalm baseline
4949
run: |

.github/workflows/unit-tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
7676
7777
echo COLUMNS=120 >> $GITHUB_ENV
78-
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration,transient" >> $GITHUB_ENV
78+
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group integration --exclude-group transient" >> $GITHUB_ENV
7979
echo COMPOSER_UP='composer update --no-progress --ansi'$([[ "${{ matrix.mode }}" != low-deps ]] && echo ' --ignore-platform-req=php+') >> $GITHUB_ENV
8080
8181
SYMFONY_VERSIONS=$(git ls-remote -q --heads | cut -f2 | grep -o '/[1-9][0-9]*\.[0-9].*' | sort -V)
@@ -131,7 +131,7 @@ jobs:
131131
fi
132132
133133
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
134-
[[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=,legacy >> $GITHUB_ENV || true
134+
[[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=" --exclude-group legacy" >> $GITHUB_ENV || true
135135
136136
echo SYMFONY_VERSION=$SYMFONY_VERSION >> $GITHUB_ENV
137137
echo COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev >> $GITHUB_ENV
@@ -197,13 +197,13 @@ jobs:
197197
fi
198198
199199
if [[ "${{ matrix.mode }}" = low-deps ]]; then
200-
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'"
200+
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT --do-not-fail-on-deprecation'"
201201
202202
exit 0
203203
fi
204204
205205
# matrix.mode = high-deps
206-
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1
206+
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY --do-not-fail-on-deprecation'" || X=1
207207
208208
# get a list of the patched components (relies on .github/build-packages.php being called in the previous step)
209209
PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
@@ -222,7 +222,7 @@ jobs:
222222
echo "::group::install phpunit"
223223
./phpunit install
224224
echo "::endgroup::"
225-
echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1
225+
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
226226
fi
227227
fi
228228
@@ -250,12 +250,12 @@ jobs:
250250
251251
mkdir -p /opt/php/lib
252252
echo memory_limit=-1 > /opt/php/lib/php.ini
253-
./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process
253+
./phpunit install
254+
./build/php/bin/php ./phpunit src/Symfony/Component/Process
254255
255-
- name: Run PhpUnitBridge tests with PHPUnit 11
256+
- name: Run PhpUnitBridge tests with PHPUnit 9.6
256257
if: '! matrix.mode'
257258
run: |
258259
./phpunit src/Symfony/Bridge/PhpUnit
259260
env:
260-
SYMFONY_PHPUNIT_VERSION: '11.3'
261-
SYMFONY_DEPRECATIONS_HELPER: 'disabled'
261+
SYMFONY_PHPUNIT_VERSION: '9.6'

.github/workflows/windows.yml

Lines changed: 102 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: read
1313

1414
jobs:
15-
windows:
15+
windows-minimal-exts:
1616
name: x86 / minimal-exts / lowest-php
1717

1818
defaults:
@@ -23,7 +23,83 @@ jobs:
2323

2424
env:
2525
COMPOSER_NO_INTERACTION: '1'
26-
SYMFONY_DEPRECATIONS_HELPER: 'strict'
26+
ANSICON: '121x90 (121x90)'
27+
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
28+
29+
steps:
30+
- name: Setup Git
31+
run: |
32+
git config --global core.autocrlf false
33+
git config --global user.email ""
34+
git config --global user.name "Symfony"
35+
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 2
40+
41+
- name: Setup PHP
42+
run: |
43+
$env:Path = 'c:\php;' + $env:Path
44+
mkdir c:\php && cd c:\php
45+
iwr -outf php.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.2.0-Win32-vs16-x86.zip
46+
7z x php.zip -y >nul
47+
Copy php.ini-development php.ini
48+
"memory_limit=-1" >> php.ini
49+
"serialize_precision=-1" >> php.ini
50+
"max_execution_time=1200" >> php.ini
51+
"post_max_size=2047M" >> php.ini
52+
"upload_max_filesize=2047M" >> php.ini
53+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
54+
"extension_dir=ext" >> php.ini
55+
"extension=php_xsl.dll" >> php.ini
56+
"extension=php_mbstring.dll" >> php.ini
57+
"extension=php_openssl.dll" >> php.ini
58+
cd ${{ github.workspace }}
59+
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
60+
61+
- name: Install dependencies
62+
id: setup
63+
run: |
64+
$env:Path = 'c:\php;' + $env:Path
65+
mkdir $env:APPDATA\Composer && Copy .github\composer-config.json $env:APPDATA\Composer\config.json
66+
67+
$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
68+
$env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev"
69+
70+
php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit
71+
php composer.phar update --no-progress --ansi
72+
73+
- name: Install PHPUnit
74+
run: |
75+
$env:Path = 'c:\php;' + $env:Path
76+
77+
php phpunit install
78+
79+
- name: Run tests
80+
run: |
81+
$env:Path = 'c:\php;' + $env:Path
82+
$x = 0
83+
84+
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
85+
mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
86+
php phpunit src\Symfony --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows || ($x = 1)
87+
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
88+
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
89+
90+
exit $x
91+
92+
windows-all-extensions:
93+
name: x86 / all extensions / lowest-php
94+
95+
defaults:
96+
run:
97+
shell: pwsh
98+
99+
runs-on: windows-2022
100+
101+
env:
102+
COMPOSER_NO_INTERACTION: '1'
27103
ANSICON: '121x90 (121x90)'
28104
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
29105

@@ -53,30 +129,28 @@ jobs:
53129
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
54130
7z x php_redis.zip -y >nul
55131
cd ..
56-
Copy php.ini-development php.ini-min
57-
"memory_limit=-1" >> php.ini-min
58-
"serialize_precision=-1" >> php.ini-min
59-
"max_execution_time=1200" >> php.ini-min
60-
"post_max_size=2047M" >> php.ini-min
61-
"upload_max_filesize=2047M" >> php.ini-min
62-
"date.timezone=`"America/Los_Angeles`"" >> php.ini-min
63-
"extension_dir=ext" >> php.ini-min
64-
"extension=php_xsl.dll" >> php.ini-min
65-
"extension=php_mbstring.dll" >> php.ini-min
66-
Copy php.ini-min php.ini-max
67-
"zend_extension=php_opcache.dll" >> php.ini-max
68-
"opcache.enable_cli=1" >> php.ini-max
69-
"extension=php_openssl.dll" >> php.ini-max
70-
"extension=php_apcu.dll" >> php.ini-max
71-
"extension=php_igbinary.dll" >> php.ini-max
72-
"extension=php_redis.dll" >> php.ini-max
73-
"apc.enable_cli=1" >> php.ini-max
74-
"extension=php_intl.dll" >> php.ini-max
75-
"extension=php_fileinfo.dll" >> php.ini-max
76-
"extension=php_pdo_sqlite.dll" >> php.ini-max
77-
"extension=php_curl.dll" >> php.ini-max
78-
"extension=php_sodium.dll" >> php.ini-max
79-
Copy php.ini-max php.ini
132+
Copy php.ini-development php.ini
133+
"memory_limit=-1" >> php.ini
134+
"serialize_precision=-1" >> php.ini
135+
"max_execution_time=1200" >> php.ini
136+
"post_max_size=2047M" >> php.ini
137+
"upload_max_filesize=2047M" >> php.ini
138+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
139+
"extension_dir=ext" >> php.ini
140+
"extension=php_xsl.dll" >> php.ini
141+
"extension=php_mbstring.dll" >> php.ini
142+
"zend_extension=php_opcache.dll" >> php.ini
143+
"opcache.enable_cli=1" >> php.ini
144+
"extension=php_openssl.dll" >> php.ini
145+
"extension=php_apcu.dll" >> php.ini
146+
"extension=php_igbinary.dll" >> php.ini
147+
"extension=php_redis.dll" >> php.ini
148+
"apc.enable_cli=1" >> php.ini
149+
"extension=php_intl.dll" >> php.ini
150+
"extension=php_fileinfo.dll" >> php.ini
151+
"extension=php_pdo_sqlite.dll" >> php.ini
152+
"extension=php_curl.dll" >> php.ini
153+
"extension=php_sodium.dll" >> php.ini
80154
cd ${{ github.workspace }}
81155
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
82156
@@ -102,32 +176,13 @@ jobs:
102176
run: |
103177
choco install --no-progress memurai-developer
104178
105-
- name: Run tests (minimal extensions)
106-
if: always() && steps.setup.outcome == 'success'
107-
run: |
108-
$env:Path = 'c:\php;' + $env:Path
109-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
110-
$x = 0
111-
112-
Copy c:\php\php.ini-min c:\php\php.ini
113-
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
114-
mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
115-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
116-
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
117-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
118-
119-
exit $x
120-
121179
- name: Run tests
122-
if: always() && steps.setup.outcome == 'success'
123180
run: |
124181
$env:Path = 'c:\php;' + $env:Path
125-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
126182
$x = 0
127183
128-
Copy c:\php\php.ini-max c:\php\php.ini
129-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
184+
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)
130185
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
131-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
186+
php phpunit src\Symfony\Component\HttpClient --requires-php-extension curl --requires-php-extension openssl || ($x = 1)
132187
133188
exit $x

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ composer.lock
33
phpunit.xml
44
.php-cs-fixer.cache
55
.php-cs-fixer.php
6+
.phpunit.cache
67
.phpunit.result.cache
78
composer.phar
89
package.tar

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
66
exit(1);
77
}
88
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
9-
putenv('SYMFONY_PHPUNIT_VERSION=9.6');
9+
putenv('SYMFONY_PHPUNIT_VERSION=11.5');
1010
}
1111
if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
1212
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1');

phpunit.xml.dist

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.3/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"
8+
failOnDeprecation="true"
89
failOnRisky="true"
910
failOnWarning="true"
1011
>
@@ -46,7 +47,7 @@
4647
</exclude>
4748
</groups>
4849

49-
<coverage>
50+
<source ignoreSuppressionOfDeprecations="true">
5051
<include>
5152
<directory>./src/Symfony/</directory>
5253
</include>
@@ -65,28 +66,11 @@
6566
<directory>./src/Symfony/Component/*/*/vendor</directory>
6667
<directory>./src/Symfony/Contracts/*/vendor</directory>
6768
</exclude>
68-
</coverage>
69+
</source>
6970

70-
<listeners>
71-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
72-
<arguments>
73-
<array>
74-
<element key="time-sensitive">
75-
<array>
76-
<element key="0"><string>Cache\IntegrationTests</string></element>
77-
<element key="1"><string>Symfony\Bridge\Doctrine\Middleware\Debug</string></element>
78-
<element key="2"><string>Symfony\Bridge\Doctrine\Middleware\IdleConnection</string></element>
79-
<element key="3"><string>Symfony\Component\Cache</string></element>
80-
<element key="4"><string>Symfony\Component\Cache\Tests\Fixtures</string></element>
81-
<element key="5"><string>Symfony\Component\Cache\Tests\Traits</string></element>
82-
<element key="6"><string>Symfony\Component\Cache\Traits</string></element>
83-
<element key="7"><string>Symfony\Component\Console</string></element>
84-
<element key="8"><string>Symfony\Component\HttpFoundation</string></element>
85-
<element key="9"><string>Symfony\Component\Uid</string></element>
86-
</array>
87-
</element>
88-
</array>
89-
</arguments>
90-
</listener>
91-
</listeners>
71+
<extensions>
72+
<bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension">
73+
<parameter name="clock-mock-namespaces" value="Cache\IntegrationTests,Symfony\Bridge\Doctrine\Middleware\Debug,Symfony\Bridge\Doctrine\Middleware\IdleConnection,Symfony\Component\Cache,Symfony\Component\Cache\Tests\Fixtures,Symfony\Component\Cache\Tests\Traits,Symfony\Component\Cache\Traits,Symfony\Component\Console,Symfony\Component\HttpFoundation,Symfony\Component\Uid" />
74+
</bootstrap>
75+
</extensions>
9276
</phpunit>

src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Doctrine\Persistence\Mapping\ClassMetadata;
1717
use Doctrine\Persistence\ObjectManager;
1818
use Doctrine\Persistence\ObjectRepository;
19+
use PHPUnit\Framework\Attributes\Group;
20+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1921
use PHPUnit\Framework\MockObject\MockObject;
2022
use PHPUnit\Framework\TestCase;
2123
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
@@ -64,9 +66,8 @@ public function testResolveWithoutManager()
6466
$this->assertSame([], $resolver->resolve($request, $argument));
6567
}
6668

67-
/**
68-
* @group legacy
69-
*/
69+
#[IgnoreDeprecations]
70+
#[Group('legacy')]
7071
public function testResolveWithNoIdAndDataOptional()
7172
{
7273
$manager = $this->createMock(ObjectManager::class);
@@ -251,9 +252,8 @@ public static function idsProvider(): iterable
251252
yield ['foo'];
252253
}
253254

254-
/**
255-
* @group legacy
256-
*/
255+
#[IgnoreDeprecations]
256+
#[Group('legacy')]
257257
public function testResolveGuessOptional()
258258
{
259259
$manager = $this->createMock(ObjectManager::class);

0 commit comments

Comments
 (0)