Skip to content

[TASK] Avoid using @covers annotations referencing methods #820

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 1 commit into from
Jan 26, 2025

Conversation

oliverklee
Copy link
Collaborator

According to the PHPUnit documentation [1], @covers annotations are only recommended to reference classes (and global functions), but not methods from classes.

Also sort the @covers annotations.

Note: This will probably artificially increase our calculated code coverage numbers until we migrate our tests to more focused unit tests.

Closes #809

[1] https://docs.phpunit.de/en/8.5/annotations.html#covers

@oliverklee oliverklee self-assigned this Jan 26, 2025
@oliverklee oliverklee changed the title [TASK] Avoid using @covers annotations for methods [TASK] Avoid using @covers annotations referencing methods Jan 26, 2025
According to the PHPUnit documentation [1], `@covers` annotations
are only recommended to reference classes (and global functions),
but not methods from classes.

Also sort the `@covers` annotations.

Note: This will probably artificially increase our calculated
code coverage numbers until we migrate our tests to more
focused unit tests.

Closes #809

[1] https://docs.phpunit.de/en/8.5/annotations.html#covers
@coveralls
Copy link

coveralls commented Jan 26, 2025

Coverage Status

coverage: 50.946% (+8.7%) from 42.261%
when pulling 4553e3a on cleanup/covers
into 7c6845f 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've added a query about an extra @covers. Otherwise looks fine.

This will probably artificially increase our calculated code coverage numbers

Maybe not artificially, as the tests are probably covering more than we previously stated they did.

* @covers \Sabberworm\CSS\Value\LineName
* @covers \Sabberworm\CSS\Value\Size
* @covers \Sabberworm\CSS\Value\URL
* @covers \Sabberworm\CSS\Value\Value
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was it intentional to add that it covers Value\Value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, as missingPropertyValueStrict and missingPropertyValueLenient had been marked as covering \Sabberworm\CSS\Value\Value::parseValue().

@JakeQZ JakeQZ merged commit 0c96d67 into main Jan 26, 2025
21 checks passed
@JakeQZ JakeQZ deleted the cleanup/covers branch January 26, 2025 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants