Skip to content

Commit b2a0265

Browse files
committed
adds codecov report
1 parent e017fb1 commit b2a0265

File tree

6 files changed

+32
-9
lines changed

6 files changed

+32
-9
lines changed

.github/workflows/php.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,23 @@ jobs:
5050
- name: WordPress unit test
5151
run: yarn php:unit
5252

53+
- name: Unit test coverage report
54+
uses: codecov/codecov-action@v4
55+
with:
56+
files: ./unit-coverage.xml
57+
flags: unittests
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
5360
- name: WordPress integration test
5461
run: yarn php:integration
5562

63+
- name: Integration test coverage report
64+
uses: codecov/codecov-action@v4
65+
with:
66+
files: ./integration-coverage.xml
67+
flags: integrationtests
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
5670
- name: WordPress integration test as multisite
5771
run: yarn php:multisite
5872

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ vendor
33
build
44
yarn-error.log
55
.phpunit.result.cache
6+
.phpunit.cache
67
.DS_Store
78
testingdb
89
.env
@@ -14,3 +15,5 @@ tests-examples/
1415
/blob-report/
1516
/playwright/.cache/
1617
build-script.sh
18+
integration-coverage.xml
19+
unit-coverage.xml

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color",
4242
"phpstan": "phpstan analyse --memory-limit=2048M",
4343
"phpstan-baseline": "phpstan analyse -b --allow-empty-baseline --memory-limit=2048M",
44-
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox --coverage-text",
45-
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text",
46-
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox --coverage-text"
44+
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox",
45+
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox ",
46+
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox"
4747
}
4848
}

phpunit-integration-multisite.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/integration/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/integration/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" cacheResultFile=".phpunit.cache/test-results" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage cacheDirectory=".phpunit.cache/code-coverage">
44
<include>
55
<directory suffix=".php">./includes</directory>
66
</include>

phpunit-integration.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/integration/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/integration/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" cacheResultFile=".phpunit.cache/test-results" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage cacheDirectory=".phpunit.cache/code-coverage">
44
<include>
55
<directory suffix=".php">./includes</directory>
66
</include>
7+
<report>
8+
<clover outputFile="integration-coverage.xml"/>
9+
</report>
710
</coverage>
811
<testsuites>
912
<testsuite name="integration">

phpunit.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/unit/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" failOnRisky="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/unit/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" failOnRisky="true" cacheResultFile=".phpunit.cache/test-results" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage cacheDirectory=".phpunit.cache/code-coverage">
44
<include>
55
<directory suffix=".php">./includes</directory>
66
</include>
7+
<report>
8+
<clover outputFile="unit-coverage.xml"/>
9+
</report>
710
</coverage>
811
<testsuites>
912
<testsuite name="unit">

0 commit comments

Comments
 (0)