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 AfterTestHook for extensions #3392

Merged
merged 1 commit into from Nov 5, 2018
Merged

Add AfterTestHook for extensions #3392

merged 1 commit into from Nov 5, 2018

Conversation

rpkamp
Copy link
Contributor

@rpkamp rpkamp commented Nov 5, 2018

Fixes #3391

So extensions have hook for some common functionality that should
happen after every test, regardless of the result.

So extensions have hook for some common functionality that should
happen after every test, regardless of the result.
@codecov
Copy link

codecov bot commented Nov 5, 2018

Codecov Report

Merging #3392 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3392      +/-   ##
============================================
+ Coverage     82.98%   82.98%   +<.01%     
- Complexity     3565     3567       +2     
============================================
  Files           143      143              
  Lines          9496     9498       +2     
============================================
+ Hits           7880     7882       +2     
  Misses         1616     1616
Impacted Files Coverage Δ Complexity Δ
src/Runner/Hook/TestListenerAdapter.php 100% <100%> (ø) 30 <0> (+2) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1349e75...34a0abd. Read the comment docs.

@sebastianbergmann sebastianbergmann merged commit 154de22 into sebastianbergmann:master Nov 5, 2018
@sebastianbergmann
Copy link
Owner

Thanks!

@localheinz
Copy link
Collaborator

localheinz commented Dec 23, 2023

@rpkamp @sebastianbergmann

Unless I am mistaken, I believe the AfterTestHook should have extended the TestHook interface.

Otherwise, if you implement an extension that only implements the AfterTestHook interface, the extension will never run:

https://github.com/sebastianbergmann/phpunit/blob/7.5.0/src/TextUI/TestRunner.php#L227-L239

Since support for phpunit/phpunit:^7.5.0 has ended, a good work-around for this problem could be to implement the another interface that extends the TestHook marker interface in an extension that still needs to support phpunit/phpunit:^7.5.0, even if that particular hook will not be needed.

Ha, looks like this has been fixed in #3762 for phpunit/phpunit:^8.3.0.

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

Successfully merging this pull request may close these issues.

None yet

3 participants