8000 run tests using PHPUnit 11.5 · symfony/symfony@890b854 · GitHub
[go: up one dir, main page]

Skip to content

Commit 890b854

Browse files
committed
run tests using PHPUnit 11.5
1 parent c10a83f commit 890b854

File tree

305 files changed

+2441
-2092
lines changed

Some content is hidden

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

305 files changed

+2441
-2092
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/unit-tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
7777
7878
echo COLUMNS=120 >> $GITHUB_ENV
79-
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration" >> $GITHUB_ENV
79+
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group integration" >> $GITHUB_ENV
8080
echo COMPOSER_UP='composer update --no-progress --ansi'$([[ "${{ matrix.mode }}" != low-deps ]] && echo ' --ignore-platform-req=php+') >> $GITHUB_ENV
8181
8282
SYMFONY_VERSIONS=$(git ls-remote -q --heads | cut -f2 | grep -o '/[1-9][0-9]*\.[0-9].*' | sort -V)
@@ -103,7 +103,6 @@ jobs:
103103
if [[ ! "${{ matrix.mode }}" = *-deps ]]; then
104104
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
105105
else
106-
echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV
107106
cp composer.json composer.json.orig
108107
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json
109108
php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin)
@@ -244,12 +243,12 @@ jobs:
244243
245244
mkdir -p /opt/php/lib
246245
echo memory_limit=-1 > /opt/php/lib/php.ini
246+
./phpunit install
247247
./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process
248248
249-
- name: Run PhpUnitBridge tests with PHPUnit 11
249+
- name: Run PhpUnitBridge tests with PHPUnit 9.6
250250
if: '! matrix.mode'
251251
run: |
252252
./phpunit src/Symfony/Bridge/PhpUnit
253253
env:
254-
SYMFONY_PHPUNIT_VERSION: '11.3'
255-
SYMFONY_DEPRECATIONS_HELPER: 'disabled'
254+
SYMFONY_PHPUNIT_VERSION: '9.6'

.github/workflows/windows.yml

Lines changed: 101 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

@@ -51,30 +50,17 @@ jobs:
5150
iwr -outf php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip
5251
7z x php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip -y >nul
5352
cd ..
54-
Copy php.ini-development php.ini-min
55-
"memory_limit=-1" >> php.ini-min
56-
"serialize_precision=-1" >> php.ini-min
57-
"max_execution_time=1200" >> php.ini-min
58-
"post_max_size=2047M" >> php.ini-min
59-
"upload_max_filesize=2047M" >> php.ini-min
60-
"date.timezone=`"America/Los_Angeles`"" >> php.ini-min
61-
"extension_dir=ext" >> php.ini-min
62-
"extension=php_xsl.dll" >> php.ini-min
63-
"extension=php_mbstring.dll" >> php.ini-min
64-
Copy php.ini-min php.ini-max
65-
"zend_extension=php_opcache.dll" >> php.ini-max
66-
"opcache.enable_cli=1" >> php.ini-max
67-
"extension=php_openssl.dll" >> php.ini-max
68-
"extension=php_apcu.dll" >> php.ini-max
69-
"extension=php_igbinary.dll" >> php.ini-max
70-
"extension=php_redis.dll" >> php.ini-max
71-
"apc.enable_cli=1" >> php.ini-max
72-
"extension=php_intl.dll" >> php.ini-max
73-
"extension=php_fileinfo.dll" >> php.ini-max
74-
"extension=php_pdo_sqlite.dll" >> php.ini-max
75-
"extension=php_curl.dll" >> php.ini-max
76-
"extension=php_sodium.dll" >> php.ini-max
77-
Copy php.ini-max php.ini
53+
Copy php.ini-development php.ini
54+
"memory_limit=-1" >> php.ini
55+
"serialize_precision=-1" >> php.ini
56+
"max_execution_time=1200" >> php.ini
57+
"post_max_size=2047M" >> php.ini
58+
"upload_max_filesize=2047M" >> php.ini
59+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
60+
"extension_dir=ext" >> php.ini
61+
"extension=php_xsl.dll" >> php.ini
62+
"extension=php_mbstring.dll" >> php.ini
63+
"extension=php_openssl.dll" >> php.ini
7864
cd ${{ github.workspace }}
7965
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
8066
@@ -100,32 +86,111 @@ jobs:
10086
run: |
10187
choco install --no-progress memurai-developer
10288
103-
- name: Run tests (minimal extensions)
104-
if: always() && steps.setup.outcome == 'success'
89+
- name: Run tests
10590
run: |
10691
$env:Path = 'c:\php;' + $env:Path
107-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
10892
$x = 0
10993
110-
Copy c:\php\php.ini-min c:\php\php.ini
11194
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
11295
mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
113-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
96+
php phpunit src\Symfony --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows || ($x = 1)
11497
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
11598
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
11699
117100
exit $x
118101
102+
windows-all-extensions:
103+
name: x86 / all extensions / lowest-php
104+
105+
defaults:
106+
run:
107+
shell: pwsh
108+
109+
runs-on: windows-2022
110+
111+
env:
112+
COMPOSER_NO_INTERACTION: '1'
113+
ANSICON: '121x90 (121x90)'
114+
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
115+
116+
steps:
117+
- name: Setup Git
118+
run: |
119+
git config --global core.autocrlf false
120+
git config --global user.email ""
121+
git config --global user.name "Symfony"
122+
123+
- name: Checkout
124+
uses: actions/checkout@v4
125+
with:
126+
fetch-depth: 2
127+
128+
- name: Setup PHP
129+
run: |
130+
$env:Path = 'c:\php;' + $env:Path
131+
mkdir c:\php && cd c:\php
132+
iwr -outf php-8.2.0-Win32-vs16-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php-8.2.0-Win32-vs16-x86.zip
133+
7z x php-8.2.0-Win32-vs16-x86.zip -y >nul
134+
cd ext
135+
iwr -outf php_apcu-5.1.22-8.2-ts-vs16-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.22-8.2-ts-vs16-x86.zip
136+
7z x php_apcu-5.1.22-8.2-ts-vs16-x86.zip -y >nul
137+
iwr -outf php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip
138+
7z x php_redis-6.0.0-dev-8.2-ts-vs16-x86.zip -y >nul
139+
cd ..
140+
Copy php.ini-development php.ini
141+
"memory_limit=-1" >> php.ini
142+
"serialize_precision=-1" >> php.ini
143+
"max_execution_time=1200" >> php.ini
144+
"post_max_size=2047M" >> php.ini
145+
"upload_max_filesize=2047M" >> php.ini
146+
"date.timezone=`"America/Los_Angeles`"" >> php.ini
147+
"extension_dir=ext" >> php.ini
148+
"extension=php_xsl.dll" >> php.ini
149+
"extension=php_mbstring.dll" >> php.ini
150+
"zend_extension=php_opcache.dll" >> php.ini
151+
"opcache.enable_cli=1" >> php.ini
152+
"extension=php_openssl.dll" >> php.ini
153+
"extension=php_apcu.dll" >> php.ini
154+
"extension=php_igbinary.dll" >> php.ini
155+
"extension=php_redis.dll" >> php.ini
156+
"apc.enable_cli=1" >> php.ini
157+
"extension=php_intl.dll" >> php.ini
158+
"extension=php_fileinfo.dll" >> php.ini
159+
"extension=php_pdo_sqlite.dll" >> php.ini
160+
"extension=php_curl.dll" >> php.ini
161+
"extension=php_sodium.dll" >> php.ini
162+
cd ${{ github.workspace }}
163+
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
164+
165+
- name: Install dependencies
166+
id: setup
167+
run: |
168+
$env:Path = 'c:\php;' + $env:Path
169+
mkdir $env:APPDATA\Composer && Copy .github\composer-config.json $env:APPDATA\Composer\config.json
170+
171+
$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
172+
$env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev"
173+
174+
php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit
175+
php composer.phar update --no-progress --ansi
176+
177+
- name: Install PHPUnit
178+
run: |
179+
$env:Path = 'c:\php;' + $env:Path
180+
181+
php phpunit install
182+
183+
- name: Install memurai-developer
184+
run: |
185+
choco install --no-progress memurai-developer
186+
119187
- name: Run tests
120-
if: always() && steps.setup.outcome == 'success'
121188
run: |
122189
$env:Path = 'c:\php;' + $env:Path
123-
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
124190
$x = 0
125191
126-
Copy c:\php\php.ini-max c:\php\php.ini
127-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
192+
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)
128193
# HttpClient tests need to run separately, they block when run with other components' tests concurrently
129-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
194+
php phpunit src\Symfony\Component\HttpClient --requires-php-extension curl --requires-php-extension openssl || ($x = 1)
130195
131196
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: 10 additions & 26 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,15 +47,15 @@
4647
</exclude>
4748
</groups>
4849

49-
<coverage>
50+
<source ignoreSuppressionOfDeprecations="true">
5051
<include>
5152
<directory>./src/Symfony/</directory>
5253
</include>
5354
<exclude>
5455
<directory>./src/Symfony/Bridge/*/Tests</directory>
5556
<directory>./src/Symfony/Component/*/Tests</directory>
5657
<directory>./src/Symfony/Component/*/*/Tests</directory>
57-
<directory>./src/Symfony/Contract/*/Tests</directory>
58+
<directory>./src/Symfony/Contracts/*/Tests</directory>
5859
<directory>./src/Symfony/Bundle/*/Tests</directory>
5960
<directory>./src/Symfony/Bundle/*/Resources</directory>
6061
<directory>./src/Symfony/Component/*/Resources</directory>
@@ -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> 10000 ;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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\Persistence\Mapping\ClassMetadata;
1717
use Doctrine\Persistence\ObjectManager;
1818
use Doctrine\Persistence\ObjectRepository;
19+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1920
use PHPUnit\Framework\MockObject\MockObject;
2021
use PHPUnit\Framework\TestCase;
2122
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
@@ -64,9 +65,7 @@ public function testResolveWithoutManager()
6465
$this->assertSame([], $resolver->resolve($request, $argument));
6566
}
6667

67-
/**
68-
* @group legacy
69-
*/
68+
#[IgnoreDeprecations]
7069
public function testResolveWithNoIdAndDataOptional()
7170
{
7271
$manager = $this->createMock(ObjectManager::class);
@@ -251,9 +250,7 @@ public static function idsProvider(): iterable
251250
yield ['foo'];
252251
}
253252

254-
/**
255-
* @group legacy
256-
*/
253+
#[IgnoreDeprecations]
257254
public function testResolveGuessOptional()
258255
{
259256
$manager = $this->createMock(ObjectManager::class);

0 commit comments

Comments
 (0)
0