-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Use expectException(Message) instead of annotations #2076
Conversation
I think that |
@@ -82,6 +79,7 @@ public function testExpressionWithoutField() | |||
|
|||
$expr = $this->createExpr(); | |||
|
|||
$this->expectException(\LogicException::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I prefer putting expectException as a first thing in a test but I'm not sure what's the preference of us as a team :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We put the expectException()
just before the thing that is expected to throw an exception, because some exceptions such as \InvalidArgumentException
can be thrown in many cases. Let me know what to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your usage is correct - test setup should not trigger the expected exception by accident. Please leave it as is 👍
9d303ee
to
b925e96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I'd squash both commits together, since it's very unlikely that we would revert one and not the other.
@greg0ire Do you want me to do the squash, or will you squash+merge? |
@olvlvl please squash, we're not using squash+merge as it's not doing an actual merge (or it wasn't doing this last time we were checking) |
Also, we would rather have you be in charge of the final commit message ;) |
The @ExpectedException and @expectedExceptionMessage annotations are deprecated. They will be removed in PHPUnit 9.
b925e96
to
3a441a7
Compare
Squashed. |
Thanks @olvlvl ! |
Summary
The
@expectedException
and@expectedExceptionMessage
annotations are deprecated. They will be removed in PHPUnit 9. This PR replaces@expectedException
and@expectedExceptionMessage
annotations withexpectedException()
andexpectedExceptionMessage()
.My only concern is with OutTest because
builder->out()
is throwing the exception, notbuilder->getPipeline()
.