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

Deprecate annotation(s) for expecting exceptions #3332

Closed
sebastianbergmann opened this Issue Oct 10, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@sebastianbergmann
Copy link
Owner

sebastianbergmann commented Oct 10, 2018

No description provided.

@sebastianbergmann sebastianbergmann added this to the PHPUnit 7.5 milestone Oct 10, 2018

@sebastianbergmann sebastianbergmann self-assigned this Oct 10, 2018

@keradus

This comment has been minimized.

Copy link
Contributor

keradus commented Oct 10, 2018

Note for interested folks:
PHP CS Fixer has a rule to automatically apply this change and convert those annotations into methods call: php_unit_no_expectation_annotation

@keradus

This comment has been minimized.

Copy link
Contributor

keradus commented Oct 10, 2018

@sebastianbergmann , would it make sense to deprecate those annotations at 7.5 and drop at 8.0 ?
As always, I'm happy to help on that

@sebastianbergmann

This comment has been minimized.

Copy link
Owner Author

sebastianbergmann commented Oct 11, 2018

While I initially wanted to do that, I do not think that the two months between December and February are enough for a deprecation period.

@keradus

This comment has been minimized.

Copy link
Contributor

keradus commented Oct 11, 2018

I believe it's fine - one thing is that it's not that short - but other, not everyone will migrate to new MAJOR at beginning of February.

looking at packagist stats ( https://repo-stats.github.io ), fragmentation is big
screenshot from 2018-10-11 13-48-38

for that, I believe it's worth to do it now instead of setting up a deprecation that would live for more than year.

burned42 added a commit to burned42/Codeception that referenced this issue Oct 17, 2018

DavertMik added a commit to Codeception/Codeception that referenced this issue Oct 18, 2018

Asserts: Add expectThrowable() method (#5213)
* Asserts: add expectThrowable()

With this method you can not only test Exceptions, like with expectException, but also Errors.

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* Asserts tests: set up test class in setUp()

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* Asserts: mention expectThrowable in the documentation

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* Asserts: add type hint

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* Asserts: since we marked expectedException as deprecated, use expectThrowable instead

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* fix typos

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* Asserts: try to make expectThrowable compatible with PHP 5.6 again

Signed-off-by: Bernd Stellwag <burned@zerties.org>

* don't use @expectedException annotation as it will get deprecated

see sebastianbergmann/phpunit#3332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.