fix: correct PHPUnit mock setups and modernize test assertions#1264
Draft
Copilot wants to merge 2 commits intophpunit-upgradefrom
Draft
fix: correct PHPUnit mock setups and modernize test assertions#1264Copilot wants to merge 2 commits intophpunit-upgradefrom
Copilot wants to merge 2 commits intophpunit-upgradefrom
Conversation
Co-authored-by: garak <179866+garak@users.noreply.github.com>
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Upgrade PHPUnit and modernize test suite
fix: correct PHPUnit mock setups and modernize test assertions
Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades PHPUnit to v12, bumps Symfony to 7.3, and modernizes the test suite to align with current toolchain requirements.
Test fixes
Root cause: Several tests mocked
Package::getOriginalObject()expecting it to be called, but the use case classes call$package->getRepository()directly on the mock. PHPUnit mocks replace all methods, so the real delegation chain is never invoked.CreateCircleCiBadgeTest::testShouldCreateDefaultBadgeOnError— removed$repointermediate mock andgetOriginalObjectexpectation; throwRuntimeExceptionfromgetRepository()to triggercatch (\Throwable)CreateComposerLockBadgeTest::testShouldCreateComposerLockBadge— mockgetRepository()directly instead of routing throughgetOriginalObject()CreateComposerLockBadgeTest::testShouldCreateDefaultBadgeOnError— same pattern;catch (\Exception)catches theRuntimeExceptionfromgetRepository()SnippetGeneratorTest improvements
int $referenceType = RouterInterface::ABSOLUTE_URLto the router mock callback to match the 3-argument signature used bySnippetGenerator::generateImg()?? 'repo_url'fallback with an explicit\InvalidArgumentExceptionfor unexpected route names, preventing regressions from masking unknown routesDependency / config notes
phpspec/prophecy-phpunitv2.4.0 already supports PHPUnit 12; no changes neededSYMFONY_PHPUNIT_VERSIONinphpunit.xml.distupdated to12.5BypassFinalExtensionregistered as a PHPUnit extension to enabledg/bypass-finalsfor final-class mocking (replaces the removed per-test hook)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.