Skip to content
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 a TestHook that fires after each test, regardless of result #3391

Closed
rpkamp opened this issue Nov 5, 2018 · 1 comment
Closed

Add a TestHook that fires after each test, regardless of result #3391

rpkamp opened this issue Nov 5, 2018 · 1 comment
Assignees
Labels
type/enhancement A new idea that should be implemented
Milestone

Comments

@rpkamp
Copy link
Contributor

rpkamp commented Nov 5, 2018

I currently have a TestListener that resets a service after each has run. This must be done regardless of the result of the test.

With the TestListener this is easy, implement TestListener::endTest() and done. However, with the new extension system no such hook exists and it seems I'd need to implement AfterIncompleteTestHook, AfterRiskyTestHook, AfterSkippedTestHook, AfterTestErrorHook, AfterSuccessfulTestHook, AfterTestFailureHook and AfterTestWarningHook. All with the same function body. That seems a bit overkill.

Is there another way to do this with an extension currently? If not, would you mind a PR that adds such a Hook?

@sebastianbergmann
Copy link
Owner

I would not mind a pull request that adds an AfterTestHook.

@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Nov 5, 2018
@sebastianbergmann sebastianbergmann added this to the PHPUnit 7.5 milestone Nov 5, 2018
@sebastianbergmann sebastianbergmann changed the title Add a Hook that fires after each test, regardless of result Add a TestHook that fires after each test, regardless of result Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants