24
24
use Sabberworm \CSS \Value \Color ;
25
25
use Sabberworm \CSS \Value \Size ;
26
26
use Sabberworm \CSS \Value \URL ;
27
+ use Sabberworm \CSS \Value \Value ;
28
+ use Sabberworm \CSS \Value \ValueList ;
27
29
28
30
/**
29
31
* @covers \Sabberworm\CSS\CSSList\Document
@@ -108,19 +110,22 @@ public function colorParsing(): void
108
110
self ::assertSame ('red ' , $ colorRuleValue );
109
111
$ colorRules = $ ruleSet ->getRules ('background- ' );
110
112
$ colorRuleValue = $ colorRules [0 ]->getValue ();
113
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
111
114
self ::assertEquals ([
112
115
'r ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNo ()),
113
116
'g ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNo ()),
114
117
'b ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNo ()),
115
118
], $ colorRuleValue ->getColor ());
116
119
$ colorRules = $ ruleSet ->getRules ('border-color ' );
117
120
$ colorRuleValue = $ colorRules [0 ]->getValue ();
121
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
118
122
self ::assertEquals ([
119
123
'r ' => new Size (10.0 , null , true , $ colorRuleValue ->getLineNo ()),
120
124
'g ' => new Size (100.0 , null , true , $ colorRuleValue ->getLineNo ()),
121
125
'b ' => new Size (230.0 , null , true , $ colorRuleValue ->getLineNo ()),
122
126
], $ colorRuleValue ->getColor ());
123
127
$ colorRuleValue = $ colorRules [1 ]->getValue ();
128
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
124
129
self ::assertEquals ([
125
130
'r ' => new Size (10.0 , null , true , $ colorRuleValue ->getLineNo ()),
126
131
'g ' => new Size (100.0 , null , true , $ colorRuleValue ->getLineNo ()),
@@ -129,6 +134,7 @@ public function colorParsing(): void
129
134
], $ colorRuleValue ->getColor ());
130
135
$ colorRules = $ ruleSet ->getRules ('outline-color ' );
131
136
$ colorRuleValue = $ colorRules [0 ]->getValue ();
137
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
132
138
self ::assertEquals ([
133
139
'r ' => new Size (34.0 , null , true , $ colorRuleValue ->getLineNo ()),
134
140
'g ' => new Size (34.0 , null , true , $ colorRuleValue ->getLineNo ()),
@@ -137,12 +143,14 @@ public function colorParsing(): void
137
143
} elseif ($ selector === '#yours ' ) {
138
144
$ colorRules = $ ruleSet ->getRules ('background-color ' );
139
145
$ colorRuleValue = $ colorRules [0 ]->getValue ();
146
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
140
147
self ::assertEquals ([
141
148
'h ' => new Size (220.0 , null , true , $ colorRuleValue ->getLineNo ()),
142
149
's ' => new Size (10.0 , '% ' , true , $ colorRuleValue ->getLineNo ()),
143
150
'l ' => new Size (220.0 , '% ' , true , $ colorRuleValue ->getLineNo ()),
144
151
], $ colorRuleValue ->getColor ());
145
152
$ colorRuleValue = $ colorRules [1 ]->getValue ();
153
+ self ::assertInstanceOf (Color::class, $ colorRuleValue );
146
154
self ::assertEquals ([
147
155
'h ' => new Size (220.0 , null , true , $ colorRuleValue ->getLineNo ()),
148
156
's ' => new Size (10.0 , '% ' , true , $ colorRuleValue ->getLineNo ()),
@@ -435,7 +443,9 @@ public function slashedValues(): void
435
443
self ::assertSame (' ' , $ fontRuleValue ->getListSeparator ());
436
444
$ fontRuleValueComponents = $ fontRuleValue ->getListComponents ();
437
445
$ commaList = $ fontRuleValueComponents [1 ];
446
+ self ::assertInstanceOf (ValueList::class, $ commaList );
438
447
$ slashList = $ fontRuleValueComponents [0 ];
448
+ self ::assertInstanceOf (ValueList::class, $ slashList );
439
449
self ::assertSame (', ' , $ commaList ->getListSeparator ());
440
450
self ::assertSame ('/ ' , $ slashList ->getListSeparator ());
441
451
$ borderRadiusRules = $ declarationBlock ->getRules ('border-radius ' );
@@ -444,7 +454,9 @@ public function slashedValues(): void
444
454
self ::assertSame ('/ ' , $ slashList ->getListSeparator ());
445
455
$ slashListComponents = $ slashList ->getListComponents ();
446
456
$ secondSlashListComponent = $ slashListComponents [1 ];
457
+ self ::assertInstanceOf (ValueList::class, $ secondSlashListComponent );
447
458
$ firstSlashListComponent = $ slashListComponents [0 ];
459
+ self ::assertInstanceOf (ValueList::class, $ firstSlashListComponent );
448
460
self ::assertSame (' ' , $ firstSlashListComponent ->getListSeparator ());
449
461
self ::assertSame (' ' , $ secondSlashListComponent ->getListSeparator ());
450
462
}
@@ -1019,6 +1031,7 @@ public function lineNumbersParsing(): void
1019
1031
$ rules = $ secondDeclarationBlock ->getRules ();
1020
1032
// Choose the 2nd one
1021
1033
$ valueOfSecondRule = $ rules [1 ]->getValue ();
1034
+ self ::assertInstanceOf (Color::class, $ valueOfSecondRule );
1022
1035
self ::assertSame (27 , $ rules [1 ]->getLineNo ());
1023
1036
1024
1037
$ actualColorLineNumbers = [];
0 commit comments