Skip to content

Commit 2f26079

Browse files
committed
chore: test with PHPunit 13
1 parent 692f74c commit 2f26079

File tree

8 files changed

+57
-59
lines changed

8 files changed

+57
-59
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MONGO_URL="mongodb://127.0.0.1:27018/dbName?compressors=disabled&gssapiServi
1010
USE_DAMA_DOCTRINE_TEST_BUNDLE="0"
1111
USE_FOUNDRY_PHPUNIT_EXTENSION="0"
1212
USE_PHP_84_LAZY_OBJECTS="0"
13-
PHPUNIT_VERSION="12" # allowed values: 9, 10, 11, 12
13+
PHPUNIT_VERSION="13" # allowed values: 9, 10, 11, 12, 13
1414

1515
# Only relevant for "reset-database" testsuite
1616
DATABASE_RESET_MODE="schema" # allowed values: schema, migrate

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/phpstan.neon export-ignore
1717
/phpunit export-ignore
1818
/phpunit.xml.dist export-ignore
19-
/phpunit-10.xml.dist export-ignore
19+
/phpunit-9.xml.dist export-ignore
2020
/phpunit-paratest.xml.dist export-ignore
2121
/psalm.xml export-ignore
2222
/stubs export-ignore

.github/workflows/phpunit.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,15 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
php: [ 8.3, 8.4, 8.5 ]
29+
php: [ 8.4, 8.5 ]
3030
symfony: [ 6.4.*, 7.4.*, 8.0.* ]
3131
database: [ mysql|mongo ]
32-
phpunit: [ 11, 12 ]
32+
phpunit: [ 13 ]
3333
use-dama: [ 1 ]
3434
use-phpunit-extension: [ 1 ]
3535
use-php-84-lazy-objects: [ 1 ]
3636
deps: [ highest ]
3737

38-
exclude:
39-
- {php: 8.3, phpunit: 11}
40-
- {php: 8.4, phpunit: 11}
41-
42-
- {php: 8.3, symfony: 8.0.*}
43-
4438
include:
4539
# old php versions
4640
- {php: 8.1, symfony: 6.4.*, phpunit: 9, database: mysql, use-phpunit-extension: 0}
@@ -49,16 +43,20 @@ jobs:
4943
# old PHPUnit versions
5044
- {php: 8.3, symfony: 7.4.*, phpunit: 9, database: mysql, use-phpunit-extension: 0}
5145
- {php: 8.4, symfony: 7.4.*, phpunit: 10, database: mysql, use-phpunit-extension: 0}
46+
- {php: 8.4, symfony: 7.4.*, phpunit: 11, database: mysql, use-phpunit-extension: 0}
47+
- {php: 8.4, symfony: 7.4.*, phpunit: 11, database: mysql}
48+
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql, use-phpunit-extension: 0}
49+
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql}
5250

5351
# test with no database (PHPUnit 9 is used to prevent some problems with empty data providers)
5452
- {php: 8.3, symfony: 7.4.*, phpunit: 9, database: none, use-phpunit-extension: 0}
5553
- {php: 8.3, symfony: 7.4.*, phpunit: 9, database: none, deps: lowest, use-phpunit-extension: 0}
5654

5755
# One permutation per DBMS
58-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mongo}
59-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: pgsql}
60-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: sqlite}
61-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql}
56+
- {php: 8.4, symfony: 7.4.*, database: mongo}
57+
- {php: 8.4, symfony: 7.4.*, database: pgsql}
58+
- {php: 8.4, symfony: 7.4.*, database: sqlite}
59+
- {php: 8.4, symfony: 7.4.*, database: mysql}
6260

6361
# lowest deps (one per DBMS)
6462
- {php: 8.3, symfony: 6.4.*, phpunit: 9, database: mysql|mongo, deps: lowest, use-phpunit-extension: 0}
@@ -68,15 +66,15 @@ jobs:
6866
- {php: 8.3, symfony: 6.4.*, phpunit: 9, database: mysql, deps: lowest, use-phpunit-extension: 0}
6967

7068
# Lowest deps with PHP 8.4 & lazy objects
71-
- {php: 8.4, symfony: 6.4.*, phpunit: 12, database: mysql|mongo, deps: lowest}
69+
- {php: 8.4, symfony: 6.4.*, database: mysql|mongo, deps: lowest}
7270

7371
# Disable Foundry's PHPUnit extension and/or dama
74-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql|mongo, use-phpunit-extension: 0}
75-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql, use-phpunit-extension: 0, use-dama: 0}
76-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql, use-dama: 0}
72+
- {php: 8.4, symfony: 7.4.*, database: mysql|mongo, use-phpunit-extension: 0}
73+
- {php: 8.4, symfony: 7.4.*, database: mysql, use-phpunit-extension: 0, use-dama: 0}
74+
- {php: 8.4, symfony: 7.4.*, database: mysql, use-dama: 0}
7775

7876
# disable lazy objects in PHP 8.4
79-
- {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql|mongo, use-php-84-lazy-objects: 0}
77+
- {php: 8.4, symfony: 7.4.*, database: mysql|mongo, use-php-84-lazy-objects: 0}
8078
env:
8179
DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || contains(matrix.database, 'sqlite') && 'sqlite:///%kernel.project_dir%/var/data.db' || '' }}
8280
MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }}
@@ -160,7 +158,7 @@ jobs:
160158
USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ matrix.use-dama == 1 && 1 || 0 }}
161159
DATABASE_RESET_MODE: ${{ matrix.reset-database-mode == 1 && 1 || 0 }}
162160
MIGRATION_CONFIGURATION_FILE: ${{ matrix.migration-configuration-file == 'no' && '' || format('tests/Fixture/MigrationTests/configs/{0}.php', matrix.migration-configuration-file) }}
163-
PHPUNIT_VERSION: 12
161+
PHPUNIT_VERSION: 13
164162
WITH_LOWEST_DEPENDENCIES: ${{ matrix.deps == 'lowest' && 1 || 0 }}
165163
USE_FOUNDRY_PHPUNIT_EXTENSION: ${{ matrix.use-phpunit-extension }}
166164
services:
@@ -304,7 +302,7 @@ jobs:
304302
USE_DAMA_DOCTRINE_TEST_BUNDLE: 1
305303
USE_FOUNDRY_PHPUNIT_EXTENSION: 1
306304
USE_PHP_84_LAZY_OBJECTS: 1
307-
PHPUNIT_VERSION: 12
305+
PHPUNIT_VERSION: 13
308306
FOUNDRY_FAKER_SEED: 1234
309307
services:
310308
mongo:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"doctrine/mongodb-odm-bundle": "^4.6|^5.0",
3838
"doctrine/orm": "^2.16|^3.0",
3939
"doctrine/persistence": "^2.0|^3.0|^4.0",
40-
"phpunit/phpunit": "^9.5.0 || ^10.0 || ^11.0 || ^12.0",
40+
"phpunit/phpunit": "^9.5.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
4141
"symfony/browser-kit": "^6.4|^7.0|^8.0",
4242
"symfony/console": "^6.4|^7.0|^8.0",
4343
"symfony/dotenv": "^6.4|^7.0|^8.0",

phpunit

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ fi
2828
### <<
2929

3030
### >> update PHPUnit if needed
31-
if [[ " 9 10 11 12 " != *" ${PHPUNIT_VERSION-9} "* ]]; then
32-
echo "❌ PHPUNIT_VERSION should be one of 9, 10, 11, 12";
31+
if [[ " 9 10 11 12 13 " != *" ${PHPUNIT_VERSION-9} "* ]]; then
32+
echo "❌ PHPUNIT_VERSION should be one of 9, 10, 11, 12, 13";
3333
exit 1;
3434
fi
3535

@@ -53,19 +53,19 @@ fi
5353
PHPUNIT_EXEC="vendor/bin/phpunit"
5454
case ${PHPUNIT_VERSION} in
5555
"9")
56-
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit.xml.dist"
56+
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit-9.xml.dist"
5757
if [ "${USE_DAMA_DOCTRINE_TEST_BUNDLE:-0}" = "1" ]; then
5858
PHPUNIT_EXEC="${PHPUNIT_EXEC} --extensions ${DAMA_EXTENSION}"
5959
fi
6060
;;
6161

6262
"10")
6363
# PHPUnit 10 does not have a --extension option
64-
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit-10.xml.dist"
64+
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit.xml.dist"
6565
;;
6666

67-
"11"|"12")
68-
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit-10.xml.dist --extension Zenstruck\Foundry\Tests\Fixture\DoctrineCascadeRelationship\PhpUnitTestExtension"
67+
"11"|"12"|"13")
68+
PHPUNIT_EXEC="${PHPUNIT_EXEC} -c phpunit.xml.dist --extension Zenstruck\Foundry\Tests\Fixture\DoctrineCascadeRelationship\PhpUnitTestExtension"
6969

7070
if [ "${USE_DAMA_DOCTRINE_TEST_BUNDLE:-0}" = "1" ]; then
7171
PHPUNIT_EXEC="${PHPUNIT_EXEC} --extension "${DAMA_EXTENSION}""
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
23
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
34
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
56
bootstrap="tests/bootstrap.php"
67
colors="true"
78
failOnRisky="true"
89
failOnWarning="true"
9-
failOnDeprecation="true"
10-
cacheDirectory=".phpunit.cache"
11-
defaultTestSuite="main">
10+
defaultTestSuite="main"
11+
>
1212
<php>
13-
<ini name="error_reporting" value="-1"/>
14-
<server name="KERNEL_CLASS" value="Zenstruck\Foundry\Tests\Fixture\TestKernel"/>
15-
<server name="SHELL_VERBOSITY" value="-1"/>
16-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
13+
<ini name="error_reporting" value="-1" />
14+
<server name="KERNEL_CLASS" value="Zenstruck\Foundry\Tests\Fixture\TestKernel" />
15+
<server name="SHELL_VERBOSITY" value="-1" />
16+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0&amp;quiet[]=indirect&amp;quiet[]=other&amp;ignoreFile=./tests/baseline-ignore"/>
1717
<env name="APP_ENV" value="test"/>
1818
</php>
19+
1920
<testsuites>
2021
<testsuite name="main">
2122
<directory>tests</directory>
2223
<exclude>tests/Integration/ResetDatabase</exclude>
24+
<exclude>tests/Integration/ForceFactoriesTraitUsage</exclude>
2325
</testsuite>
2426
<testsuite name="reset-database">
2527
<directory>tests/Integration/ResetDatabase</directory>
2628
</testsuite>
29+
<testsuite name="unit">
30+
<directory>tests/Unit</directory>
31+
</testsuite>
2732
</testsuites>
28-
<source ignoreSuppressionOfDeprecations="true" baseline="phpunit-deprecation-baseline.xml">
33+
34+
<coverage>
2935
<include>
3036
<directory>src</directory>
3137
</include>
32-
</source>
38+
</coverage>
39+
40+
<listeners>
41+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
42+
</listeners>
3343
</phpunit>

phpunit-deprecation-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ See https://github.com/zenstruck/foundry/blob/2.x/UPGRADE-2.7.md to upgrade.]]><
3030
</file>
3131
<file path="vendor/doctrine/deprecations/src/Deprecation.php">
3232
<line number="208" hash="815824609bbd80ce3a5cc8a6a19c2e6dd0c6985c">
33-
<issue><![CDATA[Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:75 called by AbstractDriverMiddleware.php:32, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)]]></issue>
33+
<issue><![CDATA[Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:70 called by AbstractDriverMiddleware.php:32, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)]]></issue>
3434
</line>
3535
</file>
3636
</files>

phpunit.xml.dist

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
43
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
65
bootstrap="tests/bootstrap.php"
76
colors="true"
87
failOnRisky="true"
98
failOnWarning="true"
10-
defaultTestSuite="main"
11-
>
9+
failOnDeprecation="true"
10+
cacheDirectory=".phpunit.cache"
11+
defaultTestSuite="main">
1212
<php>
13-
<ini name="error_reporting" value="-1" />
14-
<server name="KERNEL_CLASS" value="Zenstruck\Foundry\Tests\Fixture\TestKernel" />
15-
<server name="SHELL_VERBOSITY" value="-1" />
16-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0&amp;quiet[]=indirect&amp;quiet[]=other&amp;ignoreFile=./tests/baseline-ignore"/>
13+
<ini name="error_reporting" value="-1"/>
14+
<server name="KERNEL_CLASS" value="Zenstruck\Foundry\Tests\Fixture\TestKernel"/>
15+
<server name="SHELL_VERBOSITY" value="-1"/>
16+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
1717
<env name="APP_ENV" value="test"/>
1818
</php>
19-
2019
<testsuites>
2120
<testsuite name="main">
2221
<directory>tests</directory>
2322
<exclude>tests/Integration/ResetDatabase</exclude>
24-
<exclude>tests/Integration/ForceFactoriesTraitUsage</exclude>
2523
</testsuite>
2624
<testsuite name="reset-database">
2725
<directory>tests/Integration/ResetDatabase</directory>
2826
</testsuite>
29-
<testsuite name="unit">
30-
<directory>tests/Unit</directory>
31-
</testsuite>
3227
</testsuites>
33-
34-
<coverage>
28+
<source ignoreSuppressionOfDeprecations="true" baseline="phpunit-deprecation-baseline.xml">
3529
<include>
3630
<directory>src</directory>
3731
</include>
38-
</coverage>
39-
40-
<listeners>
41-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
42-
</listeners>
32+
</source>
4333
</phpunit>

0 commit comments

Comments
 (0)