Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,50 +105,50 @@ public function colorParsing(): void
$colorRuleValue = $colorRules[0]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'r' => new Size(35.0, null, true, $colorRuleValue->getLineNo()),
'g' => new Size(35.0, null, true, $colorRuleValue->getLineNo()),
'b' => new Size(35.0, null, true, $colorRuleValue->getLineNo()),
'r' => new Size(35.0, null, true, $colorRuleValue->getLineNumber()),
'g' => new Size(35.0, null, true, $colorRuleValue->getLineNumber()),
'b' => new Size(35.0, null, true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
$colorRules = $ruleSet->getRules('border-color');
$colorRuleValue = $colorRules[0]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'r' => new Size(10.0, null, true, $colorRuleValue->getLineNo()),
'g' => new Size(100.0, null, true, $colorRuleValue->getLineNo()),
'b' => new Size(230.0, null, true, $colorRuleValue->getLineNo()),
'r' => new Size(10.0, null, true, $colorRuleValue->getLineNumber()),
'g' => new Size(100.0, null, true, $colorRuleValue->getLineNumber()),
'b' => new Size(230.0, null, true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
$colorRuleValue = $colorRules[1]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'r' => new Size(10.0, null, true, $colorRuleValue->getLineNo()),
'g' => new Size(100.0, null, true, $colorRuleValue->getLineNo()),
'b' => new Size(231.0, null, true, $colorRuleValue->getLineNo()),
'a' => new Size('0000.3', null, true, $colorRuleValue->getLineNo()),
'r' => new Size(10.0, null, true, $colorRuleValue->getLineNumber()),
'g' => new Size(100.0, null, true, $colorRuleValue->getLineNumber()),
'b' => new Size(231.0, null, true, $colorRuleValue->getLineNumber()),
'a' => new Size('0000.3', null, true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
$colorRules = $ruleSet->getRules('outline-color');
$colorRuleValue = $colorRules[0]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'r' => new Size(34.0, null, true, $colorRuleValue->getLineNo()),
'g' => new Size(34.0, null, true, $colorRuleValue->getLineNo()),
'b' => new Size(34.0, null, true, $colorRuleValue->getLineNo()),
'r' => new Size(34.0, null, true, $colorRuleValue->getLineNumber()),
'g' => new Size(34.0, null, true, $colorRuleValue->getLineNumber()),
'b' => new Size(34.0, null, true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
} elseif ($selector === '#yours') {
$colorRules = $ruleSet->getRules('background-color');
$colorRuleValue = $colorRules[0]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'h' => new Size(220.0, null, true, $colorRuleValue->getLineNo()),
's' => new Size(10.0, '%', true, $colorRuleValue->getLineNo()),
'l' => new Size(220.0, '%', true, $colorRuleValue->getLineNo()),
'h' => new Size(220.0, null, true, $colorRuleValue->getLineNumber()),
's' => new Size(10.0, '%', true, $colorRuleValue->getLineNumber()),
'l' => new Size(220.0, '%', true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
$colorRuleValue = $colorRules[1]->getValue();
self::assertInstanceOf(Color::class, $colorRuleValue);
self::assertEquals([
'h' => new Size(220.0, null, true, $colorRuleValue->getLineNo()),
's' => new Size(10.0, '%', true, $colorRuleValue->getLineNo()),
'l' => new Size(220.0, '%', true, $colorRuleValue->getLineNo()),
'a' => new Size(0000.3, null, true, $colorRuleValue->getLineNo()),
'h' => new Size(220.0, null, true, $colorRuleValue->getLineNumber()),
's' => new Size(10.0, '%', true, $colorRuleValue->getLineNumber()),
'l' => new Size(220.0, '%', true, $colorRuleValue->getLineNumber()),
'a' => new Size(0000.3, null, true, $colorRuleValue->getLineNumber()),
], $colorRuleValue->getColor());
$colorRules = $ruleSet->getRules('outline-color');
self::assertEmpty($colorRules);
Expand Down Expand Up @@ -990,7 +990,7 @@ public function lineNumbersParsing(): void
$actualLineNumbers = [];
foreach ($document->getAllValues() as $value) {
if ($value instanceof URL) {
$actualLineNumbers[] = $value->getLineNo();
$actualLineNumbers[] = $value->getLineNumber();
}
}

Expand All @@ -1003,11 +1003,11 @@ public function lineNumbersParsing(): void
// Choose the 2nd one
$valueOfSecondRule = $rules[1]->getValue();
self::assertInstanceOf(Color::class, $valueOfSecondRule);
self::assertSame(27, $rules[1]->getLineNo());
self::assertSame(27, $rules[1]->getLineNumber());

$actualColorLineNumbers = [];
foreach ($valueOfSecondRule->getColor() as $size) {
$actualColorLineNumbers[] = $size->getLineNo();
$actualColorLineNumbers[] = $size->getLineNumber();
}

self::assertSame($expectedColorLineNumbers, $actualColorLineNumbers);
Expand All @@ -1026,7 +1026,7 @@ public function unexpectedTokenExceptionLineNo(): void
try {
$parser->parse();
} catch (UnexpectedTokenException $e) {
self::assertSame(2, $e->getLineNo());
self::assertSame(2, $e->getLineNumber());
throw $e;
}
}
Expand Down