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

Mocking a final method from a base class on a class extending it fails silently #3314

Closed
pzaj2 opened this issue Sep 27, 2018 · 1 comment
Closed

Comments

@pzaj2
Copy link

pzaj2 commented Sep 27, 2018

Q A
PHPUnit version 7.3.5
PHP version 7.2.9
Installation Method Composer

Simply put, mocking a class extending \Exception I was wondering why getMessage returns an empty string despite being mocked. It happens to be a public final method of \Exception. While I haven't checked, I'd risk saying that this will happen for other classes with final methods being extended.

Expected behaviour:
Issue / display a warning saying this method cannot be mocked / stubbed.

Actual behaviour:
The method is not mocked, it works as it would normally (in this case returning an empty string).

@sebastianbergmann
Copy link
Owner

Duplicate of #3127.

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

2 participants