Skip to content

Commit 0c96d67

Browse files
authored
[TASK] Avoid using @covers annotations referencing methods (#820)
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
1 parent d28f927 commit 0c96d67

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,3 @@ parameters:
1212
count: 2
1313
path: ../src/RuleSet/DeclarationBlock.php
1414

15-
-
16-
message: '#^@covers value \\Sabberworm\\CSS\\Value\\Value\:\:parseValue\(\) references an invalid method\.$#'
17-
identifier: phpunit.coversMethod
18-
count: 2
19-
path: ../tests/ParserTest.php
20-

tests/ParserTest.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@
2626
use Sabberworm\CSS\Value\URL;
2727

2828
/**
29+
* @covers \Sabberworm\CSS\CSSList\Document
2930
* @covers \Sabberworm\CSS\Parser
30-
* @covers \Sabberworm\CSS\CSSList\Document::parse
31-
* @covers \Sabberworm\CSS\Rule\Rule::parse
32-
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock::parse
33-
* @covers \Sabberworm\CSS\Value\CalcFunction::parse
34-
* @covers \Sabberworm\CSS\Value\Color::parse
35-
* @covers \Sabberworm\CSS\Value\CSSString::parse
36-
* @covers \Sabberworm\CSS\Value\LineName::parse
37-
* @covers \Sabberworm\CSS\Value\Size::parse
38-
* @covers \Sabberworm\CSS\Value\URL::parse
31+
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
32+
* @covers \Sabberworm\CSS\Rule\Rule
33+
* @covers \Sabberworm\CSS\Value\CSSString
34+
* @covers \Sabberworm\CSS\Value\CalcFunction
35+
* @covers \Sabberworm\CSS\Value\Color
36+
* @covers \Sabberworm\CSS\Value\LineName
37+
* @covers \Sabberworm\CSS\Value\Size
38+
* @covers \Sabberworm\CSS\Value\URL
39+
* @covers \Sabberworm\CSS\Value\Value
3940
*/
4041
final class ParserTest extends TestCase
4142
{
@@ -971,8 +972,6 @@ public function unopenedClosingBracketFailure(): void
971972
/**
972973
* Ensure that a missing property value raises an exception.
973974
*
974-
* @covers \Sabberworm\CSS\Value\Value::parseValue()
975-
*
976975
* @test
977976
*/
978977
public function missingPropertyValueStrict(): void
@@ -985,8 +984,6 @@ public function missingPropertyValueStrict(): void
985984
/**
986985
* Ensure that a missing property value is ignored when in lenient parsing mode.
987986
*
988-
* @covers \Sabberworm\CSS\Value\Value::parseValue()
989-
*
990987
* @test
991988
*/
992989
public function missingPropertyValueLenient(): void

tests/RuleSet/LenientParsingTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
use Sabberworm\CSS\Settings;
1212

1313
/**
14+
* @covers \Sabberworm\CSS\CSSList\Document
1415
* @covers \Sabberworm\CSS\Parser
15-
* @covers \Sabberworm\CSS\CSSList\Document::parse
16-
* @covers \Sabberworm\CSS\Rule\Rule::parse
17-
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock::parse
18-
* @covers \Sabberworm\CSS\Value\CalcFunction::parse
19-
* @covers \Sabberworm\CSS\Value\Color::parse
20-
* @covers \Sabberworm\CSS\Value\CSSString::parse
21-
* @covers \Sabberworm\CSS\Value\LineName::parse
22-
* @covers \Sabberworm\CSS\Value\Size::parse
23-
* @covers \Sabberworm\CSS\Value\URL::parse
16+
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
17+
* @covers \Sabberworm\CSS\Rule\Rule
18+
* @covers \Sabberworm\CSS\Value\CSSString
19+
* @covers \Sabberworm\CSS\Value\CalcFunction
20+
* @covers \Sabberworm\CSS\Value\Color
21+
* @covers \Sabberworm\CSS\Value\LineName
22+
* @covers \Sabberworm\CSS\Value\Size
23+
* @covers \Sabberworm\CSS\Value\URL
2424
*/
2525
final class LenientParsingTest extends TestCase
2626
{

0 commit comments

Comments
 (0)