Skip to content

Provide more useful information when exception/error occurs in DatabaseTestingExtension #3

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

Open
cspray opened this issue May 9, 2025 · 0 comments

Comments

@cspray
Copy link
Owner

cspray commented May 9, 2025

If an exception or error occurs in a PHPUnit extension it does not prevent the test from continuing execution. This is by-design, and there's no mechanism to accomplish this with what PHPUnit provides to extensions. The PHPUnit maintainers, do not appear open to changing this.

On top of the tests continuing, the error messages displayed by the test runner are not always informative enough to reliably debug what's happened. Stack traces, for example, often include only PHPUnit's internal methods and more thorough debugging is required to figure out what's happened. Since we won't have a first-class mechanism in PHPUnit to accomplish this we need to come up with a thorough, easy-to-use way to provide more useful information.

Alternatively, we could decide to skip the extension approach completely and implement PHPUnit's integration as a trait instead. This has its own drawbacks and pitfalls. Unfortunately, there is no "good" answer here and whatever we come up with to workaround this issue will complicate the codebase or present a less-than-ideal integration point.

A third option would be to hard exit() on failure with a descriptive message of what's went wrong. This feels like a really heavy-handed approach but might be an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant