-
Improvement
-
Resolution: Fixed
-
Major
-
4.0.0-a1, 4.0.0-a2, 4.1.0-a1, 4.0.0-b1
-
None
Since updating to PHPUnit 10, any tests that run phpBB code that can lead to phpBB's exit_handler() will now end test execution. There will be no errors. Tests will be marked as passing, even though not all tests completed. Here is an example
In PHPUnit 9, if the exit_handler was run, PHPUnit would not exit, but instead trigger an error code.
Tests could then, for example, test Ajax based JSON stuff that uses phpBB's json_response->send() and in your tests you would just expect a trigger error as validation.
This no longer happens in PHPUnit 10. But because the exit_handler now has events in it, anyone running tests that will go through the exit handler need to mock the dispatcher. That also means we can update the dispatcher to set the $exit_handler_override variable in the exit handler to true, so that we return instead of exit script execution.
That also means unit testing that was testing ajax stuff, for example, can now expectÂ
$this->expectOutputString("json response string")