Skip to content

PHPUnit Bridge unexpected deprecations #59882

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
garak opened this issue Feb 28, 2025 · 3 comments
Closed

PHPUnit Bridge unexpected deprecations #59882

garak opened this issue Feb 28, 2025 · 3 comments

Comments

@garak
Copy link
Contributor

garak commented Feb 28, 2025

Symfony version(s) affected

6.4

Description

PHP 8.4, Symfony 6.4.19, Bridge 7.2.0
I use $this->getStub(MyEntity::class) in some tests.
I get the following deprecations when I run my test suite

Remaining indirect deprecation notices (4)

  1x: The "PHPUnit\Framework\MockObject\StubInternal" interface is considered internal This interface is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "TestStub_MyEntity_3a176755".
    1x in DeprecationErrorHandler::shutdown from Symfony\Bridge\PhpUnit

  1x: The "PHPUnit\Framework\MockObject\StubApi" trait is considered internal This trait is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "TestStub_MyEntity_3a176755".
    1x in DeprecationErrorHandler::shutdown from Symfony\Bridge\PhpUnit

  1x: The "PHPUnit\Framework\MockObject\Method" trait is considered internal This trait is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "TestStub_MyEntity_3a176755".
    1x in DeprecationErrorHandler::shutdown from Symfony\Bridge\PhpUnit

  1x: The "PHPUnit\Framework\MockObject\DoubledCloneMethod" trait is considered internal This trait is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "TestStub_MyEntity_3a176755".
    1x in DeprecationErrorHandler::shutdown from Symfony\Bridge\PhpUnit

How to reproduce

Run a test with some entity stubbing

Possible Solution

From a comment I received on Slack (so, not my idea, but I trust the source): "I think the DebugClassLoader misses support for one of the PHPUnit interface used to identify generated mock classes"

Additional Context

No response

@stof
Copy link
Member

stof commented Feb 28, 2025

For reference, the comment on Slack was from me.

@xabbuh
Copy link
Member

xabbuh commented Feb 28, 2025

Can you check if #59888 fixes the issue for you?

@garak
Copy link
Contributor Author

garak commented Mar 1, 2025

Checked, it works

fabpot added a commit that referenced this issue Mar 2, 2025
…PHPUnit Stub objects (xabbuh)

This PR was merged into the 6.4 branch.

Discussion
----------

[PhpUnitBridge] don't trigger "internal" deprecations for PHPUnit Stub objects

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #59882
| License       | MIT

Commits
-------

278c808 don't trigger "internal" deprecations for PHPUnit Stub objects
@fabpot fabpot closed this as completed Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants