Skip to content

Commit a9077c3

Browse files
Different PHPUnit configs
1 parent aa4d21b commit a9077c3

File tree

3 files changed

+69
-13
lines changed

3 files changed

+69
-13
lines changed

.github/workflows/test-application.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,42 @@ jobs:
2222
- php-version: '8.0'
2323
coverage: false
2424
dependency-versions: 'lowest'
25+
phpunit-config: 'phpunit-9.xml.dist'
2526
env:
2627
SYMFONY_DEPRECATIONS_HELPER: weak
2728

2829
- php-version: '8.1'
2930
coverage: false
3031
dependency-versions: 'highest'
32+
phpunit-config: 'phpunit-9.xml.dist'
3133
env:
3234
SYMFONY_DEPRECATIONS_HELPER: weak
3335

3436
- php-version: '8.2'
3537
coverage: true
3638
dependency-versions: 'highest'
39+
phpunit-config: 'phpunit.xml.dist'
3740
env:
3841
SYMFONY_DEPRECATIONS_HELPER: weak
3942

4043
- php-version: '8.3'
4144
coverage: true
4245
dependency-versions: 'highest'
46+
phpunit-config: 'phpunit.xml.dist'
4347
env:
4448
SYMFONY_DEPRECATIONS_HELPER: weak
4549

4650
- php-version: '8.4'
4751
coverage: false
4852
dependency-versions: 'highest'
53+
phpunit-config: 'phpunit.xml.dist'
4954
env:
5055
SYMFONY_DEPRECATIONS_HELPER: weak
5156

5257
- php-version: '8.5'
5358
coverage: false
5459
dependency-versions: 'highest'
60+
phpunit-config: 'phpunit.xml.dist'
5561
env:
5662
SYMFONY_DEPRECATIONS_HELPER: weak
5763

@@ -91,7 +97,7 @@ jobs:
9197

9298
- name: Execute test cases
9399
if: matrix.coverage == false
94-
run: composer test
100+
run: composer test -- --configuration=${{ matrix.phpunit-config }}
95101

96102
- name: Execute test cases with coverage
97103
if: ${{ matrix.coverage }}

phpunit-9.xml.dist

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
backupGlobals="false"
7+
colors="true"
8+
bootstrap="tests/bootstrap.php"
9+
forceCoversAnnotation="true"
10+
>
11+
<php>
12+
<ini name="error_reporting" value="-1" />
13+
<server name="APP_ENV" value="test" force="true" />
14+
<server name="SHELL_VERBOSITY" value="-1" />
15+
<!-- See: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
16+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
17+
</php>
18+
19+
<testsuites>
20+
<!-- Run Unit Tests before Functional Tests for better Developer Experience -->
21+
<testsuite name="Project Unit Suite">
22+
<directory>tests/Unit</directory>
23+
</testsuite>
24+
25+
<testsuite name="Project Functional Suite">
26+
<directory>tests/Functional</directory>
27+
</testsuite>
28+
</testsuites>
29+
30+
<coverage processUncoveredFiles="true">
31+
<include>
32+
<directory suffix=".php">src</directory>
33+
</include>
34+
</coverage>
35+
36+
<listeners>
37+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
38+
</listeners>
39+
40+
<!-- Run `composer require symfony/panther` before enabling this extension -->
41+
<!--
42+
<extensions>
43+
<extension class="Symfony\Component\Panther\ServerExtension" />
44+
</extensions>
45+
-->
46+
</phpunit>

phpunit.xml.dist

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
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"
6-
bootstrap="vendor/autoload.php"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
76
colors="true"
8-
failOnRisky="true"
9-
failOnWarning="true"
7+
bootstrap="tests/bootstrap.php"
108
cacheDirectory=".phpunit.cache"
11-
>
9+
requireCoverageMetadata="true">
1210
<php>
13-
<ini name="error_reporting" value="-1" />
14-
<server name="APP_ENV" value="test" force="true" />
15-
<server name="SHELL_VERBOSITY" value="-1" />
11+
<ini name="error_reporting" value="-1"/>
12+
<server name="APP_ENV" value="test" force="true"/>
13+
<server name="SHELL_VERBOSITY" value="-1"/>
1614
<!-- See: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
1715
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
1816
</php>
@@ -22,15 +20,21 @@
2220
<testsuite name="Project Unit Suite">
2321
<directory>tests/Unit</directory>
2422
</testsuite>
25-
2623
<testsuite name="Project Functional Suite">
2724
<directory>tests/Functional</directory>
2825
</testsuite>
2926
</testsuites>
3027

31-
<coverage>
28+
<source>
3229
<include>
3330
<directory suffix=".php">src</directory>
3431
</include>
35-
</coverage>
32+
</source>
33+
34+
<!-- Run `composer require symfony/panther` before enabling this extension -->
35+
<!--
36+
<extensions>
37+
<extension class="Symfony\Component\Panther\ServerExtension" />
38+
</extensions>
39+
-->
3640
</phpunit>

0 commit comments

Comments
 (0)