-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add ability to mock global functions #180
Labels
Comments
If your code is namespaced, mocking out function calls is quite easy with standard PHPUnit by redefining the functions inside the namespace. See also: http://marcelog.github.io/articles/php_mock_global_functions_for_unit_tests_with_phpunit.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When writing plugins/modules for legacy platforms like WordPress, Drupal < 8, or OS Commerce, it would be nice to be able to test the code. Unfortunately, they all use global functions and specify that if you want to test your code, write some sort of facade in front of the globals to mock. It would be much nicer to be able just mock the functions themselves as long as they do not exist. An example might be:
The text was updated successfully, but these errors were encountered: