Skip to content

Commit 022669a

Browse files
committed
run tests using PHPUnit 11.5
1 parent 27fd051 commit 022669a

File tree

317 files changed

+2941
-2237
lines changed

Some content is hidden

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

317 files changed

+2941
-2237
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: 103 additions & 36 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,6 @@ jobs:
2323

2424
env:
2525
COMPOSER_NO_INTERACTION: '1'
26-
SYMFONY_DEPRECATIONS_HELPER: 'strict'
2726
ANSICON: '121x90 (121x90)'
2827
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
2928

@@ -53,30 +52,17 @@ jobs:
5352
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
5453
7z x php_redis.zip -y >nul
5554
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
55+
Copy php.ini-development php.ini
56+
"memory_limit=-1" >> php.ini
57+
"serialize_precision=-1" >> php.ini
58+
"max_execution_time=1200" >> php.ini
59+
"post_max_size=2047M" >> php.ini
60+
"upload_max_filesize=2047M" >> php.ini
61+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
62+
"extension_dir=ext" >> php.ini
63+
"extension=php_xsl.dll" >> php.ini
64+
"extension=php_mbstring.dll" >> php.ini
65+
"extension=php_openssl.dll" >> php.ini
8066
cd ${{ github.workspace }}
8167
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
8268
@@ -102,32 +88,113 @@ jobs:
10288
run: |
10389
choco install --no-progress memurai-developer
10490
105-
- name: Run tests (minimal extensions)
106-
if: always() && steps.setup.outcome == 'success'
91+
- name: Run tests
10792
run: |
10893
$env:Path = 'c:\php;' + $env:Path
109-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
11094
$x = 0
11195
112-
Copy c:\php\php.ini-min c:\php\php.ini
11396
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
11497
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)
98+
php phpunit src\Symfony --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows || ($x = 1)
11699
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
117100
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
118101
119102
exit $x
120103
104+
windows-all-extensions:
105+
name: x86 / all extensions / lowest-php
106+
107+
defaults:
108+
run:
109+
shell: pwsh
110+
111+
runs-on: windows-2022
112+
113+
env:
114+
COMPOSER_NO_INTERACTION: '1'
115+
ANSICON: '121x90 (121x90)'
116+
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
117+
118+
steps:
119+
- name: Setup Git
120+
run: |
121+
git config --global core.autocrlf false
122+
git config --global user.email ""
123+
git config --global user.name "Symfony"
124+
125+
- name: Checkout
126+
uses: actions/checkout@v4
127+
with:
128+
fetch-depth: 2
129+
130+
- name: Setup PHP
131+
run: |
132+
$env:Path = 'c:\php;' + $env:Path
133+
mkdir c:\php && cd c:\php
134+
iwr -outf php.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.2.0-Win32-vs16-x86.zip
135+
7z x php.zip -y >nul
136+
cd ext
137+
iwr -outf php_apcu.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.22-8.2-ts-vs16-x86.zip
138+
7z x php_apcu.zip -y >nul
139+
iwr -outf php_igbinary.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_igbinary-3.2.16-8.2-ts-vs16-x86.zip
140+
7z x php_igbinary.zip -y >nul
141+
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
142+
7z x php_redis.zip -y >nul
143+
cd ..
144+
Copy php.ini-development php.ini
145+
"memory_limit=-1" >> php.ini
146+
"serialize_precision=-1" >> php.ini
147+
"max_execution_time=1200" >> php.ini
148+
"post_max_size=2047M" >> php.ini
149+
"upload_max_filesize=2047M" >> php.ini
150+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
151+
"extension_dir=ext" >> php.ini
152+
"extension=php_xsl.dll" >> php.ini
153+
"extension=php_mbstring.dll" >> php.ini
154+
"zend_extension=php_opcache.dll" >> php.ini
155+
"opcache.enable_cli=1" >> php.ini
156+
"extension=php_openssl.dll" >> php.ini
157+
"extension=php_apcu.dll" >> php.ini
158+
"extension=php_igbinary.dll" >> php.ini
159+
"extension=php_redis.dll" >> php.ini
160+
"apc.enable_cli=1" >> php.ini
161+
"extension=php_intl.dll" >> php.ini
162+
"extension=php_fileinfo.dll" >> php.ini
163+
"extension=php_pdo_sqlite.dll" >> php.ini
164+
"extension=php_curl.dll" >> php.ini
165+
"extension=php_sodium.dll" >> php.ini
166+
cd ${{ github.workspace }}
167+
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
168+
169+
- name: Install dependencies
170+
id: setup
171+
run: |
172+
$env:Path = 'c:\php;' + $env:Path
173+
mkdir $env:APPDATA\Composer && Copy .github\composer-config.json $env:APPDATA\Composer\config.json
174+
175+
$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
176+
$env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev"
177+
178+
php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit
179+
php composer.phar update --no-progress --ansi
180+
181+
- name: Install PHPUnit
182+
run: |
183+
$env:Path = 'c:\php;' + $env:Path
184+
185+
php phpunit install
186+
187+
- name: Install memurai-developer
188+
run: |
189+
choco install --no-progress memurai-developer
190+
121191
- name: Run tests
122-
if: always() && steps.setup.outcome == 'success'
123192
run: |
124193
$env:Path = 'c:\php;' + $env:Path
125-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
126194
$x = 0
127195
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)
196+
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)
130197
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
131-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
198+
php phpunit src\Symfony\Component\HttpClient --requires-php-extension curl --requires-php-extension openssl || ($x = 1)
132199
133200
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)