Skip to content

[TASK] Avoid Hungarian notation in a testcase #684

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
70 changes: 35 additions & 35 deletions tests/RuleSet/LenientParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ public function faultToleranceOff(): void
{
$this->expectException(UnexpectedTokenException::class);

$sFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->beStrict());
$oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->beStrict());
$parser->parse();
}

/**
* @test
*/
public function faultToleranceOn(): void
{
$sFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->withLenientParsing(true));
$oResult = $oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->withLenientParsing(true));
$result = $parser->parse();
self::assertSame(
'.test1 {}' . "\n" . '.test2 {hello: 2.2;hello: 2000000000000.2;}' . "\n" . '#test {}' . "\n"
. '#test2 {help: none;}',
$oResult->render()
$result->render()
);
}

Expand All @@ -56,9 +56,9 @@ public function endToken(): void
{
$this->expectException(UnexpectedTokenException::class);

$sFile = __DIR__ . '/../fixtures/-end-token.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->beStrict());
$oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-end-token.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->beStrict());
$parser->parse();
}

/**
Expand All @@ -68,33 +68,33 @@ public function endToken2(): void
{
$this->expectException(UnexpectedTokenException::class);

$sFile = __DIR__ . '/../fixtures/-end-token-2.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->beStrict());
$oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-end-token-2.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->beStrict());
$parser->parse();
}

/**
* @test
*/
public function endTokenPositive(): void
{
$sFile = __DIR__ . '/../fixtures/-end-token.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->withLenientParsing(true));
$oResult = $oParser->parse();
self::assertSame('', $oResult->render());
$pathToFile = __DIR__ . '/../fixtures/-end-token.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->withLenientParsing(true));
$result = $parser->parse();
self::assertSame('', $result->render());
}

/**
* @test
*/
public function endToken2Positive(): void
{
$sFile = __DIR__ . '/../fixtures/-end-token-2.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->withLenientParsing(true));
$oResult = $oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-end-token-2.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->withLenientParsing(true));
$result = $parser->parse();
self::assertSame(
'#home .bg-layout {background-image: url("/bundles/main/img/bg1.png?5");}',
$oResult->render()
$result->render()
);
}

Expand All @@ -104,13 +104,13 @@ public function endToken2Positive(): void
public function localeTrap(): void
{
\setlocale(LC_ALL, 'pt_PT', 'no');
$sFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->withLenientParsing(true));
$oResult = $oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->withLenientParsing(true));
$result = $parser->parse();
self::assertSame(
'.test1 {}' . "\n" . '.test2 {hello: 2.2;hello: 2000000000000.2;}' . "\n" . '#test {}' . "\n"
. '#test2 {help: none;}',
$oResult->render()
$result->render()
);
}

Expand All @@ -119,17 +119,17 @@ public function localeTrap(): void
*/
public function caseInsensitivity(): void
{
$sFile = __DIR__ . '/../fixtures/case-insensitivity.css';
$oParser = new Parser(\file_get_contents($sFile));
$oResult = $oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/case-insensitivity.css';
$parser = new Parser(\file_get_contents($pathToFile));
$result = $parser->parse();

self::assertSame(
'@charset "utf-8";' . "\n"
. '@import url("test.css");'
. "\n@media screen {}"
. "\n#myid {case: insensitive !important;frequency: 30Hz;font-size: 1em;color: #ff0;"
. 'color: hsl(40,40%,30%);font-family: Arial;}',
$oResult->render()
$result->render()
);
}

Expand All @@ -138,9 +138,9 @@ public function caseInsensitivity(): void
*/
public function cssWithInvalidColorStillGetsParsedAsDocument(): void
{
$sFile = __DIR__ . '/../fixtures/invalid-color.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->withLenientParsing(true));
$result = $oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/invalid-color.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->withLenientParsing(true));
$result = $parser->parse();

self::assertInstanceOf(Document::class, $result);
}
Expand All @@ -152,8 +152,8 @@ public function invalidColorStrict(): void
{
$this->expectException(UnexpectedTokenException::class);

$sFile = __DIR__ . '/../fixtures/invalid-color.css';
$oParser = new Parser(\file_get_contents($sFile), Settings::create()->beStrict());
$oParser->parse();
$pathToFile = __DIR__ . '/../fixtures/invalid-color.css';
$parser = new Parser(\file_get_contents($pathToFile), Settings::create()->beStrict());
$parser->parse();
}
}