Repository navigation
feat(CPD-32641): support PHPUnit 10 through 12 - #80
sallainternalbot[bot] merged 15 commits into
Conversation
PHPUnit 12 removed doc-comment metadata. Every test in this package is marked with `/** @test */`, so under PHPUnit 10 or newer none of the 8 tests is collected any more: the suite reports success while running nothing, both here and in every application that includes this package's tests in its own suite. Replace the annotation with the `#[Test]` attribute, supported since PHPUnit 10. require-dev pinned phpunit/phpunit at ~8.0, which cannot be installed alongside a modern application; widen it to ^10.5|^11.5|^12.0. PHPUnit 10.5 needs PHP 8.1, but that is a require-dev concern only: this package's src/ and tests/ both lint clean on php:8.0-cli, so require.php stays at the consumer floor of 8.0. A dev install needs PHP 8.1, which is where the supported PHPUnit line starts. phpunit.xml is rewritten for the PHPUnit 10+ schema: the removed attributes (backupStaticAttributes, verbose, convertErrorsToExceptions and friends) are dropped and the filter/whitelist block becomes `<source>`. The gating those convert* flags provided is kept through their PHPUnit 10+ equivalents, failOnNotice and failOnWarning, so a notice or warning still fails the build.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | ✅ 0 (≤ 2 duplication) |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
|
/utest |
Unit Test Trigger SummaryTriggered PRs:
|
|
/canmerge |
|
|
/merge |
|
|
/merge |
|
|
/merge |
|
|
/utest |
Unit Test Trigger SummaryTriggered PRs:
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | ✅ 0 (≤ 2 duplication) |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
|
/utest |
Unit Test Trigger SummaryTriggered PRs:
|
…thub.com:SallaApp/ZATCA into feature/CPD-32641-upgrade-zatca-to-laravel-13-v2
|
/utest |
Unit Test Trigger SummaryTriggered PRs:
|
|
/merge --bypass |
|
The file |
|
Failed to bypass merge: failed to bypass merge: failed to find version for #80 |
Part of the zatca-einvoicing Laravel 13 upgrade (CPD-32641).
What kind of change does this PR introduce?
Test tooling fix. No production code is touched.
What is the current behaviour?
Every test method in this suite is marked with
/** @test */. PHPUnit 12 removed metadata in doc-comments, so those methods are no longer collected — the suite does not fail, it reports nothing. Consumers that run the package tests as part of their own suite (zatca-einvoicing includesvendor/salla/zatca/testsin itsphpunit.xml) went from 8 ZATCA tests to 0 without any signal while upgrading to Laravel 13 / PHPUnit 12.phpunit.xmlis also PHPUnit 8/9-era:backupStaticAttributes,verbose,convertErrorsToExceptions,convertNoticesToExceptions,convertWarningsToExceptionsandfilter/whitelistwere all removed in PHPUnit 10, so the config itself will not load there.What is the new behaviour?
SignInvoiceTest,GenerateCSRTestandGenerateQrCodeTestuse#[Test]phpunit/phpunitmoves from~8.0to^10.5|^11.5|^12.0phpunit.xmlis rewritten for the PHPUnit 10+ schema (filter/whitelist→<source>). The gating the removedconvert*ToExceptionsflags provided is kept through their PHPUnit 10+ equivalents,failOnNoticeandfailOnWarning, so a notice or warning still fails the buildcacheDirectoryis set (and gitignored) so PHPUnit stops warning about the default cache locationVerified locally: 8 tests, 26 assertions green on PHPUnit 12.5.35 / PHP 8.3, with
failOnNotice/failOnWarningactive — previously 0 collected.PHP requirement
Unchanged:
require.phpstays>=8.0.src/andtests/both lint clean onphp:8.0-cli, so the consumer-facing floor has no reason to move — that contract describes what the library runs on, not what its test tooling needs.Developing the package does now need PHP 8.1, because
phpunit/phpunit ^10.5is the lowest line that reads attribute metadata.require-devis root-only, so this affects contributors on an end-of-life runtime, not anyone installing the package.(The sibling PR SallaApp/E-Invoicing#30 does raise its floor to
>=8.1— that package'ssrc/declaresfinal public constand fatals on 8.0, so its>=8.0was already inaccurate. This one is genuinely 8.0-clean.)Does this PR introduce a breaking change?
No. Test-only; the published
src/and the declared PHP floor are both unchanged.Follow-up
zatca-einvoicing pins
salla/zatca: ~3.0(locked at 3.0.5) whilemasteris tagged 4.0.1, so this fix needs either a 3.0.x patch release or a decision to move that app to^4.0.Related
dev-feature/CPD-32641-upgrade-zatca-to-laravel-13-v2until this is tagged)The PR appears safe to merge; no actionable issue was identified.
Summary
The PR updates the package’s test tooling for PHPUnit 10–12 without changing production code or the declared PHP runtime requirement.
#[Test]attributes across eight test methods.Reviews (11) · Last reviewed commit: "chore: trigger unit tests [utest]"