File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 66
77use PHPUnit \Framework \TestCase ;
88use Sabberworm \CSS \OutputFormat ;
9+ use Sabberworm \CSS \Parsing \ParserState ;
910use Sabberworm \CSS \Property \Selector ;
1011use Sabberworm \CSS \Rule \Rule ;
1112use Sabberworm \CSS \RuleSet \DeclarationBlock ;
13+ use Sabberworm \CSS \Settings ;
1214
1315/**
1416 * @covers \Sabberworm\CSS\RuleSet\DeclarationBlock
1517 */
1618final class DeclarationBlockTest extends TestCase
1719{
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+
1846 /**
1947 * @test
2048 */
You can’t perform that action at this time.
0 commit comments