From 8edc7a0f04954d5a5d45fd87c79943ecbd2b66cb Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Fri, 20 Mar 2026 13:19:19 +0100 Subject: [PATCH 1/2] Add PHPUnit 10 configuration file Co-Authored-By: Claude Sonnet 4.6 --- phpunit.xml.dist | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 phpunit.xml.dist diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..ec76bf9 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,13 @@ + + + + + ./tests/ + + + + + ./src + + + From 7b8bcae5dc5bb1ef33ad22b1330d3ab612aa8507 Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Sun, 22 Mar 2026 10:07:48 +0100 Subject: [PATCH 2/2] Add PHPUnit step to CI and fix SonarCloud coverage args Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c03561..6b9c569 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,14 @@ jobs: - run: vendor/bin/rector process --dry-run if: ${{ failure() || success() }} + - run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover ./clover.xml --log-junit ./phpunit.report.xml + if: ${{ failure() || success() }} + + # https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747 + # $GITHUB_WORKSPACE contains a slash so @ is used as delimiter + - run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' clover.xml + - run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' phpunit.report.xml + - uses: sonarsource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any @@ -48,3 +56,6 @@ jobs: -Dsonar.projectKey=assoconnect_linxo-client -Dsonar.organization=assoconnect -Dsonar.sources=src + -Dsonar.tests=tests + -Dsonar.php.coverage.reportPaths=clover.xml + -Dsonar.php.tests.reportPath=phpunit.report.xml