Skip to content

Commit 8daa01a

Browse files
authored
[TASK] Avoid Hungarian notation in a testcase (#678)
Also rename some variables to be more precise and/or avoid abbreviation.
1 parent 88ddf94 commit 8daa01a

File tree

1 file changed

+87
-87
lines changed

1 file changed

+87
-87
lines changed

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class DeclarationBlockTest extends TestCase
1919
*/
2020
public function expandBorderShorthand(string $sCss, string $sExpected): void
2121
{
22-
$oParser = new Parser($sCss);
23-
$oDoc = $oParser->parse();
24-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
25-
$oDeclaration->expandBorderShorthand();
22+
$parser = new Parser($sCss);
23+
$document = $parser->parse();
24+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
25+
$declarationBlock->expandBorderShorthand();
2626
}
27-
self::assertSame(\trim((string) $oDoc), $sExpected);
27+
self::assertSame(\trim((string) $document), $sExpected);
2828
}
2929

3030
/**
@@ -49,12 +49,12 @@ public static function expandBorderShorthandProvider(): array
4949
*/
5050
public function expandFontShorthand(string $sCss, string $sExpected): void
5151
{
52-
$oParser = new Parser($sCss);
53-
$oDoc = $oParser->parse();
54-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
55-
$oDeclaration->expandFontShorthand();
52+
$parser = new Parser($sCss);
53+
$document = $parser->parse();
54+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
55+
$declarationBlock->expandFontShorthand();
5656
}
57-
self::assertSame(\trim((string) $oDoc), $sExpected);
57+
self::assertSame(\trim((string) $document), $sExpected);
5858
}
5959

6060
/**
@@ -102,12 +102,12 @@ public static function expandFontShorthandProvider(): array
102102
*/
103103
public function expandBackgroundShorthand(string $sCss, string $sExpected): void
104104
{
105-
$oParser = new Parser($sCss);
106-
$oDoc = $oParser->parse();
107-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
108-
$oDeclaration->expandBackgroundShorthand();
105+
$parser = new Parser($sCss);
106+
$document = $parser->parse();
107+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
108+
$declarationBlock->expandBackgroundShorthand();
109109
}
110-
self::assertSame(\trim((string) $oDoc), $sExpected);
110+
self::assertSame(\trim((string) $document), $sExpected);
111111
}
112112

113113
/**
@@ -152,12 +152,12 @@ public static function expandBackgroundShorthandProvider(): array
152152
*/
153153
public function expandDimensionsShorthand(string $sCss, string $sExpected): void
154154
{
155-
$oParser = new Parser($sCss);
156-
$oDoc = $oParser->parse();
157-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
158-
$oDeclaration->expandDimensionsShorthand();
155+
$parser = new Parser($sCss);
156+
$document = $parser->parse();
157+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
158+
$declarationBlock->expandDimensionsShorthand();
159159
}
160-
self::assertSame(\trim((string) $oDoc), $sExpected);
160+
self::assertSame(\trim((string) $document), $sExpected);
161161
}
162162

163163
/**
@@ -187,12 +187,12 @@ public static function expandDimensionsShorthandProvider(): array
187187
*/
188188
public function createBorderShorthand(string $sCss, string $sExpected): void
189189
{
190-
$oParser = new Parser($sCss);
191-
$oDoc = $oParser->parse();
192-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
193-
$oDeclaration->createBorderShorthand();
190+
$parser = new Parser($sCss);
191+
$document = $parser->parse();
192+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
193+
$declarationBlock->createBorderShorthand();
194194
}
195-
self::assertSame(\trim((string) $oDoc), $sExpected);
195+
self::assertSame(\trim((string) $document), $sExpected);
196196
}
197197

198198
/**
@@ -215,12 +215,12 @@ public static function createBorderShorthandProvider(): array
215215
*/
216216
public function createFontShorthand(string $sCss, string $sExpected): void
217217
{
218-
$oParser = new Parser($sCss);
219-
$oDoc = $oParser->parse();
220-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
221-
$oDeclaration->createFontShorthand();
218+
$parser = new Parser($sCss);
219+
$document = $parser->parse();
220+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
221+
$declarationBlock->createFontShorthand();
222222
}
223-
self::assertSame(\trim((string) $oDoc), $sExpected);
223+
self::assertSame(\trim((string) $document), $sExpected);
224224
}
225225

226226
/**
@@ -255,12 +255,12 @@ public static function createFontShorthandProvider(): array
255255
*/
256256
public function createDimensionsShorthand(string $sCss, string $sExpected): void
257257
{
258-
$oParser = new Parser($sCss);
259-
$oDoc = $oParser->parse();
260-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
261-
$oDeclaration->createDimensionsShorthand();
258+
$parser = new Parser($sCss);
259+
$document = $parser->parse();
260+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
261+
$declarationBlock->createDimensionsShorthand();
262262
}
263-
self::assertSame(\trim((string) $oDoc), $sExpected);
263+
self::assertSame(\trim((string) $document), $sExpected);
264264
}
265265

266266
/**
@@ -290,12 +290,12 @@ public static function createDimensionsShorthandProvider(): array
290290
*/
291291
public function createBackgroundShorthand(string $sCss, string $sExpected): void
292292
{
293-
$oParser = new Parser($sCss);
294-
$oDoc = $oParser->parse();
295-
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
296-
$oDeclaration->createBackgroundShorthand();
293+
$parser = new Parser($sCss);
294+
$document = $parser->parse();
295+
foreach ($document->getAllDeclarationBlocks() as $declarationBlock) {
296+
$declarationBlock->createBackgroundShorthand();
297297
}
298-
self::assertSame(\trim((string) $oDoc), $sExpected);
298+
self::assertSame(\trim((string) $document), $sExpected);
299299
}
300300

301301
/**
@@ -337,20 +337,20 @@ public static function createBackgroundShorthandProvider(): array
337337
public function overrideRules(): void
338338
{
339339
$sCss = '.wrapper { left: 10px; text-align: left; }';
340-
$oParser = new Parser($sCss);
341-
$oDoc = $oParser->parse();
342-
$oRule = new Rule('right');
343-
$oRule->setValue('-10px');
344-
$aContents = $oDoc->getContents();
345-
$oWrapper = $aContents[0];
346-
347-
self::assertCount(2, $oWrapper->getRules());
348-
$aContents[0]->setRules([$oRule]);
349-
350-
$aRules = $oWrapper->getRules();
351-
self::assertCount(1, $aRules);
352-
self::assertSame('right', $aRules[0]->getRule());
353-
self::assertSame('-10px', $aRules[0]->getValue());
340+
$parser = new Parser($sCss);
341+
$document = $parser->parse();
342+
$rule = new Rule('right');
343+
$rule->setValue('-10px');
344+
$contents = $document->getContents();
345+
$wrapper = $contents[0];
346+
347+
self::assertCount(2, $wrapper->getRules());
348+
$contents[0]->setRules([$rule]);
349+
350+
$rules = $wrapper->getRules();
351+
self::assertCount(1, $rules);
352+
self::assertSame('right', $rules[0]->getRule());
353+
self::assertSame('-10px', $rules[0]->getValue());
354354
}
355355

356356
/**
@@ -359,43 +359,43 @@ public function overrideRules(): void
359359
public function ruleInsertion(): void
360360
{
361361
$sCss = '.wrapper { left: 10px; text-align: left; }';
362-
$oParser = new Parser($sCss);
363-
$oDoc = $oParser->parse();
364-
$aContents = $oDoc->getContents();
365-
$oWrapper = $aContents[0];
362+
$parser = new Parser($sCss);
363+
$document = $parser->parse();
364+
$contents = $document->getContents();
365+
$wrapper = $contents[0];
366366

367-
$oFirst = $oWrapper->getRules('left');
368-
self::assertCount(1, $oFirst);
369-
$oFirst = $oFirst[0];
367+
$leftRules = $wrapper->getRules('left');
368+
self::assertCount(1, $leftRules);
369+
$firstLeftRule = $leftRules[0];
370370

371-
$oSecond = $oWrapper->getRules('text-');
372-
self::assertCount(1, $oSecond);
373-
$oSecond = $oSecond[0];
371+
$textRules = $wrapper->getRules('text-');
372+
self::assertCount(1, $textRules);
373+
$firstTextRule = $textRules[0];
374374

375-
$oBefore = new Rule('left');
376-
$oBefore->setValue(new Size(16, 'em'));
375+
$leftPrefixRule = new Rule('left');
376+
$leftPrefixRule->setValue(new Size(16, 'em'));
377377

378-
$oMiddle = new Rule('text-align');
379-
$oMiddle->setValue(new Size(1));
378+
$textAlignRule = new Rule('text-align');
379+
$textAlignRule->setValue(new Size(1));
380380

381-
$oAfter = new Rule('border-bottom-width');
382-
$oAfter->setValue(new Size(1, 'px'));
381+
$borderBottomRule = new Rule('border-bottom-width');
382+
$borderBottomRule->setValue(new Size(1, 'px'));
383383

384-
$oWrapper->addRule($oAfter);
385-
$oWrapper->addRule($oBefore, $oFirst);
386-
$oWrapper->addRule($oMiddle, $oSecond);
384+
$wrapper->addRule($borderBottomRule);
385+
$wrapper->addRule($leftPrefixRule, $firstLeftRule);
386+
$wrapper->addRule($textAlignRule, $firstTextRule);
387387

388-
$aRules = $oWrapper->getRules();
388+
$rules = $wrapper->getRules();
389389

390-
self::assertSame($oBefore, $aRules[0]);
391-
self::assertSame($oFirst, $aRules[1]);
392-
self::assertSame($oMiddle, $aRules[2]);
393-
self::assertSame($oSecond, $aRules[3]);
394-
self::assertSame($oAfter, $aRules[4]);
390+
self::assertSame($leftPrefixRule, $rules[0]);
391+
self::assertSame($firstLeftRule, $rules[1]);
392+
self::assertSame($textAlignRule, $rules[2]);
393+
self::assertSame($firstTextRule, $rules[3]);
394+
self::assertSame($borderBottomRule, $rules[4]);
395395

396396
self::assertSame(
397397
'.wrapper {left: 16em;left: 10px;text-align: 1;text-align: left;border-bottom-width: 1px;}',
398-
$oDoc->render()
398+
$document->render()
399399
);
400400
}
401401

@@ -407,14 +407,14 @@ public function ruleInsertion(): void
407407
public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands(): void
408408
{
409409
$sCss = '.rule{padding:5px;padding-top: 20px}';
410-
$oParser = new Parser($sCss);
411-
$oDoc = $oParser->parse();
412-
$aDocs = $oDoc->getAllDeclarationBlocks();
410+
$parser = new Parser($sCss);
411+
$document = $parser->parse();
412+
$declarationBlocks = $document->getAllDeclarationBlocks();
413413

414-
self::assertCount(1, $aDocs);
414+
self::assertCount(1, $declarationBlocks);
415415

416-
$oDeclaration = \array_pop($aDocs);
417-
$oDeclaration->expandShorthands();
416+
$lastDeclarationBlock = \array_pop($declarationBlocks);
417+
$lastDeclarationBlock->expandShorthands();
418418

419419
self::assertEquals(
420420
[
@@ -423,7 +423,7 @@ public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands():
423423
'padding-bottom' => 'padding-bottom: 5px;',
424424
'padding-left' => 'padding-left: 5px;',
425425
],
426-
\array_map('strval', $oDeclaration->getRulesAssoc())
426+
\array_map('strval', $lastDeclarationBlock->getRulesAssoc())
427427
);
428428
}
429429
}

0 commit comments

Comments
 (0)