-
Notifications
You must be signed in to change notification settings - Fork 144
[TASK] Add some tests for OutputFormatter
(part 2)
#949
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
e8ba8a9
to
b7edab7
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.
The tests all look good.
One needs renaming (missing "Returns").
I think in the semicolon-removal tests we should have examples that look more like CSS.
I put some other questions inline.
If we want to continue the whimsical naming of example comments used in tests, I've made some suggestions and pointed out some opportunities :)
tests/Unit/OutputFormatterTest.php
Outdated
public function commentsWithCommentableWithMoreThanTwoCommentsPutsSpaceAfterBlocksAfterLastRenderedComment(): void | ||
{ | ||
$this->outputFormat->setRenderComments(true); | ||
$this->outputFormat->setSpaceBetweenBlocks(' between-space '); |
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.
Is this needed?
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.
No, it indeed isn't. I've removed it now.
7814e2d
to
49c47ba
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.
I think a comment to explain the rationale for the setting of the spacing in the tests is required - though only needed in the first test in the list: the reader can infer from that.
I made some other suggestions which are not entirely necessary :)
And added a new issue for the weird semicolon-removal behaviour, which is identified by but beyond the scope of this PR.
tests/Unit/OutputFormatterTest.php
Outdated
$this->outputFormat->setSpaceBetweenBlocks(' between-space '); | ||
$this->outputFormat->setSpaceAfterBlocks(' after-space '); |
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 see. The comments()
method inserts these spacings (or may do). I think it would be useful to have a comment in the test to explain that - it's far from obvious.
Also autoformat the test class. The new PHPStan warning will go away once we switch the tested class to native type declarations. Part of #757
Co-authored-by: JakeQZ <[email protected]>
Co-authored-by: JakeQZ <[email protected]>
Co-authored-by: JakeQZ <[email protected]>
Co-authored-by: JakeQZ <[email protected]>
Co-authored-by: JakeQZ <[email protected]>
Co-authored-by: JakeQZ <[email protected]>
946e463
to
4b95583
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.
This is a lot clearer now. And all without any actual comments (apart from the test comments). Very nicely done.
Also autoformat the test class.
The new PHPStan warning will go away once we switch the tested class to native type declarations.
Part of #757