Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PhpUnitBridge] Clean up mocked features only when@group is present#60484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:7.2fromHypeMC:fix-symfonyextension
May 20, 2025

Conversation

HypeMC
Copy link
Member

QA
Branch?7.2
Bug fix?yes
New feature?no
Deprecations?no
Issues-
LicenseMIT

PR#60174 introduced a bug for tests that don't use the@group annotation but register mocks manually, e.g. insetUpBeforeClass:

class ExampleTestextends TestCase{publicstaticfunctionsetUpBeforeClass():void    {        ClockMock::register(self::class);        ClockMock::withClockMock(strtotime('2024-05-20 15:30:00'));    }publicstaticfunctiontearDownAfterClass():void    {        ClockMock::withClockMock(false);    }publicfunctiontestDate()    {self::assertSame('2024-05-20 15:30:00',date('Y-m-d H:i:s'));    }publicfunctiontestTime()    {self::assertSame(1716219000,time());    }}

testDate passes, but after thatFinishedSubscriber is triggered which cleans up the mock and causestestTime to fail.

I am not sure what to do aboutBeforeTestMethodErroredSubscriber since the test object is not available in that event. I think it's fine to leave it as is.

cc@xabbuh

@xabbuh
Copy link
Member

The change looks good. 👍 We need to update the code a bit after merging it into the7.3 branch to account for the attributes introduced in#59384.

I am not sure what to do aboutBeforeTestMethodErroredSubscriber since the test object is not available in that event. I think it's fine to leave it as is.

We can access the test with PHPUnit 12.1+ (seesebastianbergmann/phpunit@9f05cee).

@HypeMCHypeMCforce-pushed thefix-symfonyextension branch fromf1ced79 tocc14427CompareMay 20, 2025 07:51
@HypeMC
Copy link
MemberAuthor

@HypeMCHypeMCforce-pushed thefix-symfonyextension branch fromcc14427 toea204b9CompareMay 20, 2025 09:10
@nicolas-grekas
Copy link
Member

Thank you@HypeMC.

@nicolas-grekasnicolas-grekas merged commit920035e intosymfony:7.2May 20, 2025
11 of 12 checks passed
@HypeMCHypeMC deleted the fix-symfonyextension branchMay 20, 2025 11:31
fabpot added a commit that referenced this pull requestMay 24, 2025
…butes (HypeMC)This PR was merged into the 7.3 branch.Discussion----------[PhpUnitBridge] Fix cleaning up mocked features with attributes| Q             | A| ------------- | ---| Branch?       | 7.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | -| License       | MITFixes usage of the attributes introduced in#59384 to reflect changes made in#60484.Commits-------62da782 [PhpUnitBridge] Fix cleaning up mocked features with attributes
This was referencedMay 25, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@xabbuhxabbuhxabbuh approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.2
Development

Successfully merging this pull request may close these issues.

4 participants
@HypeMC@xabbuh@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp