-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Unexpected PHP behavior #10223
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
Unexpected PHP behavior #10223
Conversation
Following up on symfony/symfony#28259
components/phpunit_bridge.rst
Outdated
class namespace when the annotated test is run. Because of a PHP unexpected | ||
behavior (see https://bugs.php.net/bug.php?id=64346), a test may pass when | ||
run alone but fail when run in a tests suite if the tested class is used | ||
before these time and dns functions are defined. Configuring the mocked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About this:
Configuring the mocked namespaces in the
phpunit.xml
file may solve this issue too.
Could you please explain this in more detail? What should we add in the phpunit.xml file? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiereguiluz I've added the example provided by nicolas-grekas on symfony/symfony#28259
Do you think it's enough?
Thanks for the PR. I don't think we should blame PHP at all here, so let's forget about mentioning any bug report. What about: Under the hood, a PHPUnit listener injects the mocked functions in the tested
|
@nicolas-grekas done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks!
components/phpunit_bridge.rst
Outdated
tests are constructed, this might be too late. In this case, you will need to declare | ||
the namespaces of the tested classes in your phpunit.xml.dist | ||
|
||
```` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. code-block:: xml
should probably be used here instead of 4 backticks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
Thank you @sylfabre. |
This PR was submitted for the 4.1 branch but it was squashed and merged into the 3.4 branch instead (closes #10223). Discussion ---------- Unexpected PHP behavior Following up on symfony/symfony#28259 Commits ------- a320038 Unexpected PHP behavior
Following up on symfony/symfony#28259