Skip to content

[TASK] Avoid Hungarian notation in a testcase #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024
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
62 changes: 31 additions & 31 deletions tests/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ final class OutputFormatTest extends TestCase
/**
* @var Parser
*/
private $oParser;
private $parser;

/**
* @var Document
*/
private $oDocument;
private $document;

protected function setUp(): void
{
$this->oParser = new Parser(self::TEST_CSS);
$this->oDocument = $this->oParser->parse();
$this->parser = new Parser(self::TEST_CSS);
$this->document = $this->parser->parse();
}

/**
Expand All @@ -57,7 +57,7 @@ public function plain(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render()
$this->document->render()
);
}

Expand All @@ -69,7 +69,7 @@ public function compact(): void
self::assertSame(
'.main,.test{font:italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background:white;}'
. '@media screen{.main{background-size:100% 100%;font-size:1.3em;background-color:#fff;}}',
$this->oDocument->render(OutputFormat::createCompact())
$this->document->render(OutputFormat::createCompact())
);
}

Expand All @@ -78,7 +78,7 @@ public function compact(): void
*/
public function pretty(): void
{
self::assertSame(self::TEST_CSS, $this->oDocument->render(OutputFormat::createPretty()));
self::assertSame(self::TEST_CSS, $this->document->render(OutputFormat::createPretty()));
}

/**
Expand All @@ -90,7 +90,7 @@ public function spaceAfterListArgumentSeparator(): void
'.main, .test {font: italic normal bold 16px/ 1.2 '
. '"Helvetica", Verdana, sans-serif;background: white;}'
. "\n@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}",
$this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(' '))
$this->document->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(' '))
);
}

Expand All @@ -102,7 +102,7 @@ public function spaceAfterListArgumentSeparatorComplex(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;background: white;}'
. "\n@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}",
$this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator([
$this->document->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator([
'default' => ' ',
',' => "\t",
'/' => '',
Expand All @@ -120,7 +120,7 @@ public function spaceAfterSelectorSeparator(): void
'.main,
.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setSpaceAfterSelectorSeparator("\n"))
$this->document->render(OutputFormat::create()->setSpaceAfterSelectorSeparator("\n"))
);
}

Expand All @@ -132,7 +132,7 @@ public function stringQuotingType(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 \'Helvetica\',Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setStringQuotingType("'"))
$this->document->render(OutputFormat::create()->setStringQuotingType("'"))
);
}

Expand All @@ -144,7 +144,7 @@ public function rGBHashNotation(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: rgb(255,255,255);}}',
$this->oDocument->render(OutputFormat::create()->setRGBHashNotation(false))
$this->document->render(OutputFormat::create()->setRGBHashNotation(false))
);
}

Expand All @@ -156,7 +156,7 @@ public function semicolonAfterLastRule(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff}}',
$this->oDocument->render(OutputFormat::create()->setSemicolonAfterLastRule(false))
$this->document->render(OutputFormat::create()->setSemicolonAfterLastRule(false))
);
}

Expand All @@ -168,7 +168,7 @@ public function spaceAfterRuleName(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setSpaceAfterRuleName("\t"))
$this->document->render(OutputFormat::create()->setSpaceAfterRuleName("\t"))
);
}

Expand All @@ -185,7 +185,7 @@ public function spaceRules(): void
background-size: 100% 100%;
font-size: 1.3em;
background-color: #fff;
}}', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")));
}}', $this->document->render(OutputFormat::create()->set('Space*Rules', "\n")));
}

/**
Expand All @@ -198,7 +198,7 @@ public function spaceBlocks(): void
@media screen {
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
}
', $this->oDocument->render(OutputFormat::create()->set('Space*Blocks', "\n")));
', $this->document->render(OutputFormat::create()->set('Space*Blocks', "\n")));
}

/**
Expand All @@ -218,7 +218,7 @@ public function spaceBoth(): void
background-color: #fff;
}
}
', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")));
', $this->document->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")));
}

/**
Expand All @@ -229,7 +229,7 @@ public function spaceBetweenBlocks(): void
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}'
. '@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setSpaceBetweenBlocks(''))
$this->document->render(OutputFormat::create()->setSpaceBetweenBlocks(''))
);
}

Expand All @@ -250,7 +250,7 @@ public function indentation(): void
background-color: #fff;
}
}
', $this->oDocument->render(OutputFormat::create()
', $this->document->render(OutputFormat::create()
->set('Space*Rules', "\n")
->set('Space*Blocks', "\n")
->setIndentation('')));
Expand All @@ -264,7 +264,7 @@ public function spaceBeforeBraces(): void
self::assertSame(
'.main, .test{font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen{.main{background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setSpaceBeforeOpeningBrace(''))
$this->document->render(OutputFormat::create()->setSpaceBeforeOpeningBrace(''))
);
}

Expand All @@ -275,30 +275,30 @@ public function ignoreExceptionsOff(): void
{
$this->expectException(OutputException::class);

$aBlocks = $this->oDocument->getAllDeclarationBlocks();
$oFirstBlock = $aBlocks[0];
$oFirstBlock->removeSelector('.main');
$declarationBlocks = $this->document->getAllDeclarationBlocks();
$firstDeclarationBlock = $declarationBlocks[0];
$firstDeclarationBlock->removeSelector('.main');
self::assertSame(
'.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false))
$this->document->render(OutputFormat::create()->setIgnoreExceptions(false))
);
$oFirstBlock->removeSelector('.test');
$this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false));
$firstDeclarationBlock->removeSelector('.test');
$this->document->render(OutputFormat::create()->setIgnoreExceptions(false));
}

/**
* @test
*/
public function ignoreExceptionsOn(): void
{
$aBlocks = $this->oDocument->getAllDeclarationBlocks();
$oFirstBlock = $aBlocks[0];
$oFirstBlock->removeSelector('.main');
$oFirstBlock->removeSelector('.test');
$declarationBlocks = $this->document->getAllDeclarationBlocks();
$firstDeclarationBlock = $declarationBlocks[0];
$firstDeclarationBlock->removeSelector('.main');
$firstDeclarationBlock->removeSelector('.test');
self::assertSame(
'@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}',
$this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(true))
$this->document->render(OutputFormat::create()->setIgnoreExceptions(true))
);
}
}