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

Exceptions in the destructor of a test double are ignored #5634

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Dec 31, 2023

Currently, if an exception is thrown in a mock object's destructor, it's silently ignored because of the following:

} catch (Throwable $e) {
$error = true;
}

@sebastianbergmann sebastianbergmann added feature/test-doubles Test Stubs and Mock Objects type/bug Something is broken labels Dec 31, 2023
Copy link

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4918913) 89.40% compared to head (fbe6e70) 89.40%.

Additional details and impacted files
@@            Coverage Diff            @@
##               10.5    #5634   +/-   ##
=========================================
  Coverage     89.40%   89.40%           
- Complexity     6407     6408    +1     
=========================================
  Files           682      682           
  Lines         20378    20383    +5     
=========================================
+ Hits          18218    18224    +6     
+ Misses         2160     2159    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann sebastianbergmann merged commit c61d971 into sebastianbergmann:10.5 Dec 31, 2023
31 checks passed
@sebastianbergmann sebastianbergmann changed the title Don't silently ignore exceptions in mock object's destructor Exceptions in the destructor of a test double are ignored Dec 31, 2023
@HypeMC HypeMC deleted the fix-exception-in-mock-destructor branch December 31, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-doubles Test Stubs and Mock Objects type/bug Something is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants