From 7d607e25c7713a1fcb7cc7947c2a75323c0fae64 Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Wed, 9 Sep 2026 22:54:24 +0300 Subject: [PATCH 1/3] fix(tests): exit non-zero when the TestBootstrapper cannot be found exit('message') terminates the process with status 0, so a failure to locate the platform TestBootstrapper left the PHPUnit job green with not a single test executed. The three fallback paths exist because the platform layout already moved twice (shopware/platform monorepo, shopware/core split, in-tree), so a third move would have silently greened this job. CompletionGuard cannot cover this: it is registered inside TestBootstrapper::bootstrap(), which is never reached here. Refs https://github.com/shopware/shopware/issues/18667 --- tests/TestBootstrap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/TestBootstrap.php b/tests/TestBootstrap.php index 2c360ea5b..ad56a102c 100644 --- a/tests/TestBootstrap.php +++ b/tests/TestBootstrap.php @@ -14,7 +14,8 @@ } elseif (is_readable(__DIR__ . '/../../../../src/Core/TestBootstrapper.php')) { require __DIR__ . '/../../../../src/Core/TestBootstrapper.php'; } else { - exit('Could not find TestBootstrapper.php'); + fwrite(\STDERR, 'Could not find TestBootstrapper.php' . \PHP_EOL); + exit(1); } return (new TestBootstrapper()) From 6e6ed94a35f02291bacd88c6f780ffeccfe577b3 Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Wed, 9 Sep 2026 23:53:40 +0300 Subject: [PATCH 2/3] feat(ci): report PHPUnit coverage to Codecov Only the Integration workflow opts in: it runs on pull requests and on push to trunk, so Codecov gets the trunk baseline its project status compares against. Nightly runs the same suite and would add nothing. .github/codecov.yml sets the project and patch thresholds. Neither status is a required check in this repository, so a coverage drop reports red without blocking a merge. CODECOV_TOKEN is an organization secret already available here, so no new secret is needed. Refs https://github.com/shopware/shopware/issues/18667 --- .github/codecov.yml | 10 ++++++++++ .github/workflows/action-phpunit.yml | 19 ++++++++++++++++++- .github/workflows/integration.yaml | 3 +++ .gitignore | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..f1594699f --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + threshold: 0.01% + patch: + default: + target: auto + threshold: 5% + base: auto diff --git a/.github/workflows/action-phpunit.yml b/.github/workflows/action-phpunit.yml index 855bb828f..36bbaa8c7 100644 --- a/.github/workflows/action-phpunit.yml +++ b/.github/workflows/action-phpunit.yml @@ -9,6 +9,13 @@ on: platform_branch: required: true type: string + coverage: + required: false + type: boolean + default: false + secrets: + CODECOV_TOKEN: + required: false jobs: phpunit: @@ -36,4 +43,14 @@ jobs: run: mysql -uroot < _fixtures/database/shopware55.sql - name: Run PHPUnit - run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit + run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit -- ${{ inputs.coverage && '--coverage-cobertura coverage.xml' || '' }} + + - name: Upload coverage to Codecov + if: inputs.coverage + uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + root_dir: ${{ github.workspace }}/custom/plugins/${{ inputs.extension_name }} + working-directory: custom/plugins/${{ inputs.extension_name }} + files: coverage.xml diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 7b874d6d0..a6c3ae3df 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -48,6 +48,9 @@ jobs: with: extension_name: ${{ github.event.repository.name }} platform_branch: trunk + coverage: true + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} smoke_test: name: Smoke test diff --git a/.gitignore b/.gitignore index 4b17edd14..40b3ded78 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ src/Resources/app/administration/.tmp # plugin /migration_assistant.cache +/coverage.xml From dbd2ee04f70bbe4219d95fa002dcca749960f834 Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Thu, 10 Sep 2026 00:06:06 +0300 Subject: [PATCH 3/3] fix(ci): align the Codecov upload with the other plugin repositories SwagCmsExtensions, SwagSocialShopping and SwagPublisher all upload clover from an absolute working directory with root_dir set, and so does shopware/github-actions/phpunit. Matching that keeps the four migration repositories from being a fifth dialect, and clover is the format the PHPUnit shipped with Shopware 5 also understands, so every repository can use one. Drops .github/codecov.yml: no other plugin ships one, Codecov posts both statuses from its own defaults without it, and the file only replaced those defaults with the platform's tolerances. It also failed the admin lint job, which prettier-checks .github/**/*.yml. Replaces #[CoversClass(MigrationLogEntry::class)] with the abstract class the test actually exercises. MigrationLogEntry is an interface, which PHPUnit rejects as a coverage target, and with failOnWarning="true" that turned the suite red for all 37 tests in the class as soon as coverage was switched on. --- .github/codecov.yml | 10 ---------- .github/workflows/action-phpunit.yml | 6 +++--- .gitignore | 2 +- tests/unit/Migration/Logging/Log/MigrationLogTest.php | 3 +-- 4 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml deleted file mode 100644 index f1594699f..000000000 --- a/.github/codecov.yml +++ /dev/null @@ -1,10 +0,0 @@ -coverage: - status: - project: - default: - threshold: 0.01% - patch: - default: - target: auto - threshold: 5% - base: auto diff --git a/.github/workflows/action-phpunit.yml b/.github/workflows/action-phpunit.yml index 36bbaa8c7..0c10ea016 100644 --- a/.github/workflows/action-phpunit.yml +++ b/.github/workflows/action-phpunit.yml @@ -43,7 +43,7 @@ jobs: run: mysql -uroot < _fixtures/database/shopware55.sql - name: Run PHPUnit - run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit -- ${{ inputs.coverage && '--coverage-cobertura coverage.xml' || '' }} + run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit -- ${{ inputs.coverage && '--coverage-clover clover.xml' || '' }} - name: Upload coverage to Codecov if: inputs.coverage @@ -52,5 +52,5 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: root_dir: ${{ github.workspace }}/custom/plugins/${{ inputs.extension_name }} - working-directory: custom/plugins/${{ inputs.extension_name }} - files: coverage.xml + working-directory: ${{ github.workspace }}/custom/plugins/${{ inputs.extension_name }} + files: ./clover.xml diff --git a/.gitignore b/.gitignore index 40b3ded78..662f8beaf 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,4 @@ src/Resources/app/administration/.tmp # plugin /migration_assistant.cache -/coverage.xml +/clover.xml diff --git a/tests/unit/Migration/Logging/Log/MigrationLogTest.php b/tests/unit/Migration/Logging/Log/MigrationLogTest.php index a5486ebb6..f7e2c2a55 100644 --- a/tests/unit/Migration/Logging/Log/MigrationLogTest.php +++ b/tests/unit/Migration/Logging/Log/MigrationLogTest.php @@ -15,7 +15,6 @@ use SwagMigrationAssistant\Migration\Connection\SwagMigrationConnectionEntity; use SwagMigrationAssistant\Migration\Logging\Log\Builder\AbstractMigrationLogEntry; use SwagMigrationAssistant\Migration\Logging\Log\Builder\MigrationLogBuilder; -use SwagMigrationAssistant\Migration\Logging\Log\Builder\MigrationLogEntry; use SwagMigrationAssistant\Migration\Logging\Log\ConvertAssociationMissingLog; use SwagMigrationAssistant\Migration\Logging\Log\ConvertChildEntityFailedLog; use SwagMigrationAssistant\Migration\Logging\Log\ConvertDocumentTypeUnsupportedLog; @@ -56,7 +55,7 @@ * @internal */ #[Package('fundamentals@after-sales')] -#[CoversClass(MigrationLogEntry::class)] +#[CoversClass(AbstractMigrationLogEntry::class)] class MigrationLogTest extends TestCase { /**