Skip to content

Commit 06a7fad

Browse files
authored
Merge branch 'main' into bugfix/size-constructor-parameters
2 parents 2a0fd11 + 0c96d67 commit 06a7fad

25 files changed

+214
-209
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Please also have a look at our
1111
### Added
1212

1313
- Partial support for CSS Color Module Level 4:
14-
- `rgb` and `rgba`, and `hsl` and `hsla` are now aliases (#797}
15-
- Parse color functions that use the "modern" syntax (#800)
14+
- `rgb` and `rgba`, and `hsl` and `hsla` are now aliases (#797}
15+
- Parse color functions that use the "modern" syntax (#800)
1616
- Add official support for PHP 8.4 (#657)
1717
- Support arithmetic operators in CSS function arguments (#607)
1818
- Add support for inserting an item in a CSS list (#545)

config/phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@ parameters:
66
count: 2
77
path: ../src/OutputFormat.php
88

9-
-
10-
message: '#^@covers value \\Sabberworm\\CSS\\Value\\Value\:\:parseValue\(\) references an invalid method\.$#'
11-
identifier: phpunit.coversMethod
12-
count: 2
13-
path: ../tests/ParserTest.php
14-

tests/Comment/CommentTest.php

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
namespace Sabberworm\CSS\Tests\Comment;
66

77
use PHPUnit\Framework\TestCase;
8-
use Sabberworm\CSS\Comment\Comment;
98
use Sabberworm\CSS\OutputFormat;
10-
use Sabberworm\CSS\Renderable;
119
use Sabberworm\CSS\Tests\ParserTest as TestsParserTest;
1210

1311
/**
@@ -17,97 +15,6 @@
1715
*/
1816
final class CommentTest extends TestCase
1917
{
20-
/**
21-
* @test
22-
*/
23-
public function implementsRenderable(): void
24-
{
25-
$subject = new Comment();
26-
27-
self::assertInstanceOf(Renderable::class, $subject);
28-
}
29-
30-
/**
31-
* @test
32-
*/
33-
public function getCommentOnEmptyInstanceReturnsReturnsEmptyString(): void
34-
{
35-
$subject = new Comment();
36-
37-
self::assertSame('', $subject->getComment());
38-
}
39-
40-
/**
41-
* @test
42-
*/
43-
public function getCommentInitiallyReturnsCommentPassedToConstructor(): void
44-
{
45-
$comment = 'There is no spoon.';
46-
$subject = new Comment($comment);
47-
48-
self::assertSame($comment, $subject->getComment());
49-
}
50-
51-
/**
52-
* @test
53-
*/
54-
public function setCommentSetsComments(): void
55-
{
56-
$comment = 'There is no spoon.';
57-
$subject = new Comment();
58-
59-
$subject->setComment($comment);
60-
61-
self::assertSame($comment, $subject->getComment());
62-
}
63-
64-
/**
65-
* @test
66-
*/
67-
public function getLineNoOnEmptyInstanceReturnsReturnsZero(): void
68-
{
69-
$subject = new Comment();
70-
71-
self::assertSame(0, $subject->getLineNo());
72-
}
73-
74-
/**
75-
* @test
76-
*/
77-
public function getLineNoInitiallyReturnsLineNumberPassedToConstructor(): void
78-
{
79-
$lineNumber = 42;
80-
$subject = new Comment('', $lineNumber);
81-
82-
self::assertSame($lineNumber, $subject->getLineNo());
83-
}
84-
85-
/**
86-
* @test
87-
*/
88-
public function toStringRendersCommentEnclosedInCommentDelimiters(): void
89-
{
90-
$comment = 'There is no spoon.';
91-
$subject = new Comment();
92-
93-
$subject->setComment($comment);
94-
95-
self::assertSame('/*' . $comment . '*/', (string) $subject);
96-
}
97-
98-
/**
99-
* @test
100-
*/
101-
public function renderRendersCommentEnclosedInCommentDelimiters(): void
102-
{
103-
$comment = 'There is no spoon.';
104-
$subject = new Comment();
105-
106-
$subject->setComment($comment);
107-
108-
self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat()));
109-
}
110-
11118
/**
11219
* @test
11320
*/

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
{

tests/CSSList/KeyFrameTest.php renamed to tests/Unit/CSSList/KeyFrameTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Sabberworm\CSS\Tests\CSSList;
5+
namespace Sabberworm\CSS\Tests\Unit\CSSList;
66

77
use PHPUnit\Framework\TestCase;
88
use Sabberworm\CSS\Comment\Commentable;
@@ -18,7 +18,7 @@ final class KeyFrameTest extends TestCase
1818
/**
1919
* @var KeyFrame
2020
*/
21-
protected $subject;
21+
private $subject;
2222

2323
protected function setUp(): void
2424
{

tests/Unit/Comment/CommentTest.php

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit\Comment;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\Comment\Comment;
9+
use Sabberworm\CSS\OutputFormat;
10+
use Sabberworm\CSS\Renderable;
11+
12+
/**
13+
* @covers \Sabberworm\CSS\Comment\Comment
14+
*/
15+
final class CommentTest extends TestCase
16+
{
17+
/**
18+
* @test
19+
*/
20+
public function implementsRenderable(): void
21+
{
22+
$subject = new Comment();
23+
24+
self::assertInstanceOf(Renderable::class, $subject);
25+
}
26+
27+
/**
28+
* @test
29+
*/
30+
public function getCommentOnEmptyInstanceReturnsEmptyString(): void
31+
{
32+
$subject = new Comment();
33+
34+
self::assertSame('', $subject->getComment());
35+
}
36+
37+
/**
38+
* @test
39+
*/
40+
public function getCommentInitiallyReturnsCommentPassedToConstructor(): void
41+
{
42+
$comment = 'There is no spoon.';
43+
$subject = new Comment($comment);
44+
45+
self::assertSame($comment, $subject->getComment());
46+
}
47+
48+
/**
49+
* @test
50+
*/
51+
public function setCommentSetsComments(): void
52+
{
53+
$comment = 'There is no spoon.';
54+
$subject = new Comment();
55+
56+
$subject->setComment($comment);
57+
58+
self::assertSame($comment, $subject->getComment());
59+
}
60+
61+
/**
62+
* @test
63+
*/
64+
public function getLineNoOnEmptyInstanceReturnsZero(): void
65+
{
66+
$subject = new Comment();
67+
68+
self::assertSame(0, $subject->getLineNo());
69+
}
70+
71+
/**
72+
* @test
73+
*/
74+
public function getLineNoInitiallyReturnsLineNumberPassedToConstructor(): void
75+
{
76+
$lineNumber = 42;
77+
$subject = new Comment('', $lineNumber);
78+
79+
self::assertSame($lineNumber, $subject->getLineNo());
80+
}
81+
82+
/**
83+
* @test
84+
*/
85+
public function toStringRendersCommentEnclosedInCommentDelimiters(): void
86+
{
87+
$comment = 'There is no spoon.';
88+
$subject = new Comment();
89+
90+
$subject->setComment($comment);
91+
92+
self::assertSame('/*' . $comment . '*/', (string) $subject);
93+
}
94+
95+
/**
96+
* @test
97+
*/
98+
public function renderRendersCommentEnclosedInCommentDelimiters(): void
99+
{
100+
$comment = 'There is no spoon.';
101+
$subject = new Comment();
102+
103+
$subject->setComment($comment);
104+
105+
self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat()));
106+
}
107+
}

tests/fixtures/-fault-tolerance.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.test1 {
2-
//gaga: hello;
2+
//gaga: hello;
33
}
44

55
.test2 {
6-
*hello: 1;
7-
hello: 2.2;
8-
hello: 2000000000000.2;
6+
*hello: 1;
7+
hello: 2.2;
8+
hello: 2000000000000.2;
99
}
1010

1111
#test {
12-
#hello: 1}
12+
#hello: 1}
1313

1414
#test2 {
15-
help: none;
15+
help: none;

tests/fixtures/1readme.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
font-family: "CrassRoots";
55
src: url("../media/cr.ttf")
66
}
7-
7+
88
html, body {
9-
font-size: 1.6em
9+
font-size: 1.6em
1010
}

tests/fixtures/2readme.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#header {
2-
margin: 10px 2em 1cm 2%;
3-
font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
4-
color: red !important;
2+
margin: 10px 2em 1cm 2%;
3+
font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
4+
color: red !important;
55
}

0 commit comments

Comments
 (0)