Skip to content

Commit 4d77037

Browse files
committed
Avoid running phpt tests with coverage
When PHPUnit runs in coverage mode, it pre-loads all files. The files being tested in the End2EndPhpt test suite need to be able to run code _before_ any PHP_CodeSniffer classes are loaded, this isn't compatible. To avoid this, we are moving this test suite to the 'end to end' test stage, where we do not run code coverage.
1 parent 50a5e7a commit 4d77037

4 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/workflows/end-to-end-tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ jobs:
4848
ini-values: "error_reporting=-1, display_errors=On, display_startup_errors=On"
4949
coverage: none
5050

51+
# Install dependencies and handle caching in one go.
52+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
53+
- name: Install Composer dependencies
54+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
55+
with:
56+
composer-options: ${{ matrix.php == '8.6' && '--ignore-platform-req=php+' || '' }}
57+
custom-cache-suffix: $(date -u "+%Y-%m")
58+
59+
- name: 'PHPUnit: run end-to-end tests (phpt)'
60+
run: php "vendor/bin/phpunit" -c phpunit-e2e.xml.dist --no-coverage
61+
5162
- name: "Install bashunit"
5263
shell: bash
5364
run: |

phpunit-e2e.xml.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.2/phpunit.xsd"
5+
backupGlobals="true"
6+
beStrictAboutOutputDuringTests="true"
7+
beStrictAboutTestsThatDoNotTestAnything="true"
8+
convertErrorsToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertDeprecationsToExceptions="true"
12+
>
13+
<testsuites>
14+
<testsuite name="End2EndPhpt">
15+
<directory suffix=".phpt">tests/EndToEndPhpt/</directory>
16+
</testsuite>
17+
</testsuites>
18+
</phpunit>

phpunit-lte9.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
<directory>./src/Standards/Squiz/Tests/</directory>
2626
<directory>./src/Standards/Zend/Tests/</directory>
2727
</testsuite>
28-
<testsuite name="End2EndPhpt">
29-
<directory suffix=".phpt">tests/EndToEndPhpt/</directory>
30-
</testsuite>
3128
</testsuites>
3229

3330
<groups>

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
<directory>./src/Standards/Squiz/Tests/</directory>
3232
<directory>./src/Standards/Zend/Tests/</directory>
3333
</testsuite>
34-
<testsuite name="End2EndPhpt">
35-
<directory suffix=".phpt">tests/EndToEndPhpt/</directory>
36-
</testsuite>
3734
</testsuites>
3835

3936
<groups>

0 commit comments

Comments
 (0)