Skip to content

Issue/622 Upgrade PHPUnit to 10 - #632

Merged
armanist merged 10 commits into
quantum-php:3.1.xfrom
armanist:issue/622-phpunit-10
Oct 29, 2026
Merged

armanist merged 10 commits into
quantum-php:3.1.xfrom
armanist:issue/622-phpunit-10

Conversation

@armanist

Copy link
Copy Markdown
Collaborator

Closes #622.

What changed

  • composer.json: phpunit/phpunit goes from ^9.0 to ^10.5. It is a development dependency, so applications are not affected.
  • phpunit.xml is migrated to the PHPUnit 10 schema (verbose and convertDeprecationsToExceptions are gone, <coverage> becomes <source>, and the cache directory .phpunit.cache, already in .gitignore, is set).
  • The 11 data providers are static, as PHPUnit 10 expects (18 deprecations).
  • error_reporting in phpunit.xml is now -1, as Symfony and Doctrine ORM set it. It was the text E_ALL & ~E_DEPRECATED, which PHP reads as 0, so every PHP warning was hidden in the tests on PHPUnit 9. The same setting in tests/bootstrap.php is removed.
  • Five bugs that those hidden warnings covered are fixed, each with a test that failed before the fix:
    • core:env printed .env is successfully generated and tried to copy the file after .env.example file not found: it now stops after the error (src/Console/Commands/EnvCommand.php).
    • flush() of the session adapters called session_destroy() with no active session, so calling it twice raised a warning that the error handler turns into an exception (src/Session/Traits/SessionTrait.php).
    • listDirectory() of the Dropbox and Google Drive adapters returned null, or false only through a caught warning, for a response without entries or files. It now returns false, as its contract says.
    • Two OpenApiCommandTest fixtures had #[OA\Info] and no endpoint, which swagger-php reports as Required @OA\PathItem() not found; they now have one (test only).

Why

PHPUnit 9 is no longer the current line, and PHP 8.1 (#595) made PHPUnit 10 possible. Running the suite on PHPUnit 10 showed 6 tests that PHPUnit 9 passes. They are not caused by PHPUnit 10: the same 6 fail on PHPUnit 9 once error_reporting is a real number. The setting in phpunit.xml never worked, so each of them triggers a real PHP warning that was hidden.

Breaking changes

None for applications. A contributor has to run composer update to get PHPUnit 10.

Testing

  • The full suite, run alone on PHPUnit 10.5.66 with CI's flags (--stderr --fail-on-warning --fail-on-risky): 1834 tests with 31 errors, all Class "Redis" not found or Class "Memcached" not found (the extensions are missing where I ran it, and CI provides them), and 0 PHPUnit deprecations. PHPUnit 9 shows the same 31.
  • PHP 8.2 with PHPUnit 10 gives the same result, plus 5 QueryIdiormTest failures from a PDO driver that is missing in that PHP install.
  • Not run: PHP 8.3, and composer test with --coverage-clover, because there is no coverage driver where I ran it, so the Codecov upload is only checked by CI here.
  • One ZipAdapterTest::testExtractToFromZip failure appeared once in a full run and not in the next run or when the class ran alone, so it looks like a flaky file state on Windows.

Notes for reviewers

  • This pull request targets 3.1.x.
  • The checkpoints are separate commits on purpose: the first six keep the suite green on PHPUnit 9, and only the seventh upgrades PHPUnit.
  • tests/Unit/ErrorReportingTest.php, a guard test added in the sixth commit, is removed in the seventh: PHPUnit 10 lowers error_reporting itself while it handles errors, so a test cannot read the configured level.

armanist and others added 8 commits October 28, 2026 20:43
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f783228b-fb11-4c80-bdd8-118dad7b74d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@armanist
armanist requested a review from artem-dev2 October 29, 2026 09:33
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@armanist
armanist merged commit 4487992 into quantum-php:3.1.x Oct 29, 2026
5 of 6 checks passed
@armanist
armanist deleted the issue/622-phpunit-10 branch October 29, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants