File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use PHPUnit \Framework \TestCase ;
8
8
use Sabberworm \CSS \OutputFormat ;
9
+ use Sabberworm \CSS \Parsing \ParserState ;
9
10
use Sabberworm \CSS \Property \Selector ;
10
11
use Sabberworm \CSS \Rule \Rule ;
11
12
use Sabberworm \CSS \RuleSet \DeclarationBlock ;
13
+ use Sabberworm \CSS \Settings ;
12
14
13
15
/**
14
16
* @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
15
17
*/
16
18
final class DeclarationBlockTest extends TestCase
17
19
{
20
+ /**
21
+ * @return array<string, array{0: string}>
22
+ */
23
+ public static function provideInvalidDeclarationBlock (): array
24
+ {
25
+ return [
26
+ 'no selector ' => ['{ color: red; } ' ],
27
+ 'invalid selector ' => ['/ { color: red; } ' ],
28
+ 'no opening brace ' => ['body color: red; } ' ],
29
+ ];
30
+ }
31
+
32
+ /**
33
+ * @test
34
+ *
35
+ * @dataProvider provideInvalidDeclarationBlock
36
+ */
37
+ public function parseReturnsNullForInvalidDeclarationBlock (string $ invalidDeclarationBlock ): void
38
+ {
39
+ $ parserState = new ParserState ($ invalidDeclarationBlock , Settings::create ());
40
+
41
+ $ result = DeclarationBlock::parse ($ parserState );
42
+
43
+ self ::assertSame (null , $ result );
44
+ }
45
+
18
46
/**
19
47
* @test
20
48
*/
You can’t perform that action at this time.
0 commit comments