Skip to content

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

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/phpunit_bridge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ namespaces in the ``phpunit.xml`` file, as done for example in the
</listener>
</listeners>
</phpunit>

Under the hood, this component defines time and dns functions in the tested
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
Copy link
Member

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!

Copy link
Contributor Author

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?

namespaces in the ``phpunit.xml`` file may solve this issue too.

Modified PHPUnit script
-----------------------
Expand Down