Skip to content

[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

Merged
merged 11 commits into from
Feb 20, 2025

Conversation

oliverklee
Copy link
Collaborator

@oliverklee oliverklee commented Feb 17, 2025

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

@coveralls
Copy link

coveralls commented Feb 17, 2025

Coverage Status

coverage: 51.709% (+0.4%) from 51.335%
when pulling 7f71e80 on task/tests/outputformatter-2
into 2be1044 on main.

@oliverklee oliverklee force-pushed the task/tests/outputformatter-2 branch from e8ba8a9 to b7edab7 Compare February 17, 2025 23:19
Copy link
Collaborator

@JakeQZ JakeQZ left a 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 :)

public function commentsWithCommentableWithMoreThanTwoCommentsPutsSpaceAfterBlocksAfterLastRenderedComment(): void
{
$this->outputFormat->setRenderComments(true);
$this->outputFormat->setSpaceBetweenBlocks(' between-space ');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Collaborator Author

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.

@oliverklee oliverklee force-pushed the task/tests/outputformatter-2 branch 2 times, most recently from 7814e2d to 49c47ba Compare February 18, 2025 23:01
@oliverklee oliverklee requested a review from JakeQZ February 19, 2025 09:46
Copy link
Collaborator

@JakeQZ JakeQZ left a 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.

Comment on lines 374 to 387
$this->outputFormat->setSpaceBetweenBlocks(' between-space ');
$this->outputFormat->setSpaceAfterBlocks(' after-space ');
Copy link
Collaborator

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.

@oliverklee oliverklee force-pushed the task/tests/outputformatter-2 branch from 946e463 to 4b95583 Compare February 20, 2025 08:25
@oliverklee oliverklee requested a review from JakeQZ February 20, 2025 08:32
Copy link
Collaborator

@JakeQZ JakeQZ left a 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.

@JakeQZ JakeQZ merged commit dc6014b into main Feb 20, 2025
21 checks passed
@JakeQZ JakeQZ deleted the task/tests/outputformatter-2 branch February 20, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants