Skip to content

[TASK] Reduce and finetune the scope of @covers annotations #1188

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
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/CSSList/AtRuleBlockListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

/**
* @covers \Sabberworm\CSS\CSSList\AtRuleBlockList
* @covers \Sabberworm\CSS\CSSList\CSSBlockList
* @covers \Sabberworm\CSS\CSSList\CSSList
*/
final class AtRuleBlockListTest extends TestCase
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Comment/CommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
use Sabberworm\CSS\Tests\ParserTest as TestsParserTest;

/**
* @covers \Sabberworm\CSS\Comment\Comment
* @covers \Sabberworm\CSS\OutputFormat
* @covers \Sabberworm\CSS\OutputFormatter
* @coversNothing
Comment on lines -13 to +12
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this cover Comment::render() and ParserState::consumeWhitespace()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment::render() is called. As far as I understand the tests (which is not far), they're about other elements rendering comments (or not) depending on the OutputFormat settings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it's outputFormatter::comments() where the controlling logic is.

*/
final class CommentTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Sabberworm\CSS\Parsing\OutputException;

/**
* @covers \Sabberworm\CSS\OutputFormat
* @coversNothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this covering various OutputFormat methods (create* and some of the setters)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As far as I understand this test, it's not about covering how OutputFormat works, but about how other elements get rendered depending on the output format.

*/
final class OutputFormatTest extends TestCase
{
Expand Down
10 changes: 0 additions & 10 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,7 @@
use Sabberworm\CSS\Value\ValueList;

/**
* @covers \Sabberworm\CSS\CSSList\Document
* @covers \Sabberworm\CSS\Parser
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
* @covers \Sabberworm\CSS\Rule\Rule
* @covers \Sabberworm\CSS\Value\CSSString
* @covers \Sabberworm\CSS\Value\CalcFunction
* @covers \Sabberworm\CSS\Value\Color
* @covers \Sabberworm\CSS\Value\LineName
* @covers \Sabberworm\CSS\Value\Size
* @covers \Sabberworm\CSS\Value\URL
* @covers \Sabberworm\CSS\Value\Value
*/
final class ParserTest extends TestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/RuleSet/DeclarationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

/**
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
* @covers \Sabberworm\CSS\RuleSet\RuleSet
*/
final class DeclarationBlockTest extends TestCase
{
Expand Down
11 changes: 1 addition & 10 deletions tests/RuleSet/LenientParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@
use Sabberworm\CSS\Settings;

/**
* @covers \Sabberworm\CSS\CSSList\Document
* @covers \Sabberworm\CSS\Parser
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
* @covers \Sabberworm\CSS\Rule\Rule
* @covers \Sabberworm\CSS\Value\CSSString
* @covers \Sabberworm\CSS\Value\CalcFunction
* @covers \Sabberworm\CSS\Value\Color
* @covers \Sabberworm\CSS\Value\LineName
* @covers \Sabberworm\CSS\Value\Size
* @covers \Sabberworm\CSS\Value\URL
* @coversNothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree it's generally not clear which of the classes this covers - but doesn't it at least cover Settings to some extent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It calls code in Settings (and uses it). It does not test whether Settings actually work correctly, though, and the point of the tests is not testing Settings (as far as I understand them), but how other code works depending on the settings.

*/
final class LenientParsingTest extends TestCase
{
Expand Down