-
Notifications
You must be signed in to change notification settings - Fork 150
[TASK] Add tests for the exceptions #911
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
Conversation
JakeQZ
left a comment
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.
I like the running theme of amusing and bizarre messages used in the tests. (Some hosts give me tea in the morning when coffee is expected; YMMV.)
I think one of the test methods (repeated 4 times) is conflated, and that there should be two separate test methods: one for the message, and one for the line number.
I'm also wondering about the duplication. I think it's right to also test that the extended classes' behaviour match the base (where that is expected). But I wonder if it's possible to have a base class or trait for the TestCase to provide the common tests - if that would work with PHPUnit which I know relies on @test in the DocBlock.
| /** | ||
| * @test | ||
| */ | ||
| public function getMessageForLineNumberProvidedIncludesMessage(): void |
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.
Ditto (re two separate tests and naming).
| /** | ||
| * @test | ||
| */ | ||
| public function getMessageForLineNumberProvidedIncludesMessage(): void |
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.
Ditto.
| /** | ||
| * @test | ||
| */ | ||
| public function getMessageForLineNumberProvidedIncludesMessage(): void |
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.
Ditto.
| /** | ||
| * @test | ||
| */ | ||
| public function getMessageForLineNumberProvidedIncludesMessage(): void |
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.
GitHub lost my comment here. The various 'dittos' refer to this.
I think this is conflating two tests, one that the line number is included, and one that the message is included when a line number is provided. Also the name is confusing. I'd suggest
getMessageWithLineNumberProvidedIncludesMessageandgetMessageWithLineNumberProvidedIncludesLineNumber.
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.
Thanks, I mixed up the tests names indeed. Fixed.
As far as the message provided to the constructor is concerned, we already have the getMessageReturnsMessageProvidedToConstructor tests for cases where the exception actually uses the message provided to the constructor.
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.
True, but we don't have a test to confirm the message when a line number argument is passed.
JakeQZ
left a comment
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.
I added back (roughly) a key comment that GitHub lost.
c9aa358 to
3dff61d
Compare
❤️ |
For class testing hierarchies, we could add an I'll add tests for the |
Duplicated code shrieks at me. It's much less maintainable, It's fine for now, but I would like to come up with a way of avoiding it. |
JakeQZ
left a comment
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.
Added #919 to cover possible clean-up.
Part of #757