Skip to content

[TASK] Add more tests for OutputFormat #893

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 3 commits into from
Feb 10, 2025
Merged

[TASK] Add more tests for OutputFormat #893

merged 3 commits into from
Feb 10, 2025

Conversation

oliverklee
Copy link
Collaborator

No description provided.

@coveralls
Copy link

coveralls commented Feb 9, 2025

Coverage Status

coverage: 49.156%. remained the same
when pulling ede4dd7 on task/more-tests
into 5e05197 on main.

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 like the way these tests are narrowing-down expected behaviour.

A couple of minor issues, and some comments beyond the scope of this PR.

/**
* @test
*/
public function createPrettyReturnsNewOutputFormatInstance(): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think "New" is redundant in the test method name, but it's consistent with createCompactReturnsNewOutputFormatInstance, which I signed off 🤷

/**
* @test
*/
public function createPrettyCalledTwoTimesReturnsDifferentInstances(): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm thinking (and agreeing) "TwoTimes" is better than "Twice" for non-native-English speaking coders.

{
$newInstance = OutputFormat::createPretty();

self::assertSame([',' => ' '], $newInstance->getSpaceAfterListArgumentSeparators());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this just test that the key , has the value {space} - instead of the whole array?

Copy link
Collaborator

@JakeQZ JakeQZ Feb 10, 2025

Choose a reason for hiding this comment

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

Or maybe the test method should be renamed to indicate it's checking the whole array by adding On;y at the end of its name.

@oliverklee oliverklee requested a review from JakeQZ February 10, 2025 09:00
@oliverklee
Copy link
Collaborator Author

Updated and repushed.

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.

WFM now

@JakeQZ JakeQZ merged commit 5c440f3 into main Feb 10, 2025
21 checks passed
@JakeQZ JakeQZ deleted the task/more-tests branch February 10, 2025 09:19
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