Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions tests/Comment/CommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class CommentTest extends TestCase
*/
public function keepCommentsInOutput(): void
{
$oCss = TestsParserTest::parsedStructureForFile('comments');
$cssDocument = TestsParserTest::parsedStructureForFile('comments');
self::assertSame('/** Number 11 **/

/**
Expand All @@ -45,15 +45,15 @@ public function keepCommentsInOutput(): void
position: absolute;
}
}
', $oCss->render(OutputFormat::createPretty()));
', $cssDocument->render(OutputFormat::createPretty()));
self::assertSame(
'/** Number 11 **//**' . "\n"
. ' * Comments' . "\n"
. ' *//* Hell */@import url("some/url.css") screen;'
. '/* Number 4 *//* Number 5 */.foo,#bar{'
. '/* Number 6 */background-color:#000;}@media screen{'
. '/** Number 10 **/#foo.bar{/** Number 10b **/position:absolute;}}',
$oCss->render(OutputFormat::createCompact()->setRenderComments(true))
$cssDocument->render(OutputFormat::createCompact()->setRenderComments(true))
);
}

Expand Down
30 changes: 15 additions & 15 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public function colorParsing(): void
self::assertEmpty($colorRules);
}
}
foreach ($document->getAllValues('color') as $sColor) {
self::assertSame('red', $sColor);
foreach ($document->getAllValues('color') as $colorValue) {
self::assertSame('red', $colorValue);
}
self::assertSame(
'#mine {color: red;border-color: #0a64e6;border-color: rgba(10,100,231,.3);outline-color: #222;'
Expand Down Expand Up @@ -463,9 +463,9 @@ public function functionSyntax(): void
. '.collapser.expanded + * {height: auto;}';
self::assertSame($expected, $document->render());

foreach ($document->getAllValues(null, true) as $mValue) {
if ($mValue instanceof Size && $mValue->isSize()) {
$mValue->setSize($mValue->getSize() * 3);
foreach ($document->getAllValues(null, true) as $value) {
if ($value instanceof Size && $value->isSize()) {
$value->setSize($value->getSize() * 3);
}
}
$expected = \str_replace(['1.2em', '.2em', '60%'], ['3.6em', '.6em', '180%'], $expected);
Expand Down Expand Up @@ -952,12 +952,12 @@ public function missingPropertyValueLenient(): void
* Parses structure for file.
*
* @param string $filename
* @param Settings|null $oSettings
* @param Settings|null $settings
*/
public static function parsedStructureForFile($filename, $oSettings = null): Document
public static function parsedStructureForFile($filename, $settings = null): Document
{
$filename = __DIR__ . "/fixtures/$filename.css";
$parser = new Parser(\file_get_contents($filename), $oSettings);
$parser = new Parser(\file_get_contents($filename), $settings);
return $parser->parse();
}

Expand Down Expand Up @@ -1011,8 +1011,8 @@ public function lineNumbersParsing(): void
self::assertSame(27, $rules[1]->getLineNo());

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

self::assertSame($expectedColorLineNumbers, $actualColorLineNumbers);
Expand Down Expand Up @@ -1044,16 +1044,16 @@ public function unexpectedTokenExceptionLineNo(): void
public function commentExtracting(): void
{
$document = self::parsedStructureForFile('comments');
$aNodes = $document->getContents();
$nodes = $document->getContents();

// Import property.
$importComments = $aNodes[0]->getComments();
$importComments = $nodes[0]->getComments();
self::assertCount(2, $importComments);
self::assertSame("*\n * Comments\n ", $importComments[0]->getComment());
self::assertSame(' Hell ', $importComments[1]->getComment());

// Declaration block.
$fooBarBlock = $aNodes[1];
$fooBarBlock = $nodes[1];
$fooBarBlockComments = $fooBarBlock->getComments();
// TODO Support comments in selectors.
// $this->assertCount(2, $fooBarBlockComments);
Expand All @@ -1068,11 +1068,11 @@ public function commentExtracting(): void
self::assertSame(' Number 6 ', $fooBarRuleComments[0]->getComment());

// Media property.
$mediaComments = $aNodes[2]->getComments();
$mediaComments = $nodes[2]->getComments();
self::assertCount(0, $mediaComments);

// Media children.
$mediaRules = $aNodes[2]->getContents();
$mediaRules = $nodes[2]->getContents();
$fooBarComments = $mediaRules[0]->getComments();
self::assertCount(1, $fooBarComments);
self::assertSame('* Number 10 *', $fooBarComments[0]->getComment());
Expand Down
8 changes: 4 additions & 4 deletions tests/RuleSet/DeclarationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ final class DeclarationBlockTest extends TestCase
*/
public function overrideRules(): void
{
$sCss = '.wrapper { left: 10px; text-align: left; }';
$parser = new Parser($sCss);
$css = '.wrapper { left: 10px; text-align: left; }';
$parser = new Parser($css);
$document = $parser->parse();
$rule = new Rule('right');
$rule->setValue('-10px');
Expand All @@ -43,8 +43,8 @@ public function overrideRules(): void
*/
public function ruleInsertion(): void
{
$sCss = '.wrapper { left: 10px; text-align: left; }';
$parser = new Parser($sCss);
$css = '.wrapper { left: 10px; text-align: left; }';
$parser = new Parser($css);
$document = $parser->parse();
$contents = $document->getContents();
$wrapper = $contents[0];
Expand Down