-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Don't deprecate setExpectedException()
, this will cause issues.
#2074
Comments
The |
@schlessera If I understood the article correctly, you have to replace
So the annotation will stay and Sebastian recommend to use |
@schlessera deprecating a function means that it still works but you should consider migrating to the new way. So there is no harm there. You will simply need to migrate your tests to the new methods before upgrading to PHPUnit 6 in 2017 |
@alexislefebvre Yes, thank you. I understood that. The issue for me is that the new A number of my clients are still on PHP 5.5, so I'm currently running all my code with PHPUnit 4.8. I would prefer to have all my code on PHP7, but I don't always control the hosting environment of my clients. |
@stof Yes, I will probably stay with |
@schlessera You can create a class which inherit from Example (not tested):
In your tests:
|
…t before deprecating PHPUnit methods: sebastianbergmann/phpunit#2074
…t before deprecating PHPUnit methods: sebastianbergmann/phpunit#2074
I just read the article https://thephp.cc/news/2016/02/questioning-phpunit-best-practices, and cannot really comprehend the conclusion.
I applaud the move to a better structure to test exceptions. And I have always used the
setExpectedException()
instead of the annotation, because of some of the reasons you have mentioned.However, in the article, the conclusion is that
setExpectedException()
will be deprecated for PHPUnit 6, and the annotation will stay.This means that I cannot use the new functions because of the PHP version requirements, and can't continue to use
setExpectedException()
because it will become deprecated... so you basically force me to instead use the annotation now for the foreseeable future.I think that there's no harm in keeping the
setExpectedException()
method for now, and it can be rewritten as a simple stub that uses the new methods for better maintainability. So please don't deprecate it (just yet).The text was updated successfully, but these errors were encountered: