@@ -19,12 +19,12 @@ final class DeclarationBlockTest extends TestCase
19
19
*/
20
20
public function expandBorderShorthand (string $ sCss , string $ sExpected ): void
21
21
{
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 ();
26
26
}
27
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
27
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
28
28
}
29
29
30
30
/**
@@ -49,12 +49,12 @@ public static function expandBorderShorthandProvider(): array
49
49
*/
50
50
public function expandFontShorthand (string $ sCss , string $ sExpected ): void
51
51
{
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 ();
56
56
}
57
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
57
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
58
58
}
59
59
60
60
/**
@@ -102,12 +102,12 @@ public static function expandFontShorthandProvider(): array
102
102
*/
103
103
public function expandBackgroundShorthand (string $ sCss , string $ sExpected ): void
104
104
{
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 ();
109
109
}
110
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
110
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
111
111
}
112
112
113
113
/**
@@ -152,12 +152,12 @@ public static function expandBackgroundShorthandProvider(): array
152
152
*/
153
153
public function expandDimensionsShorthand (string $ sCss , string $ sExpected ): void
154
154
{
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 ();
159
159
}
160
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
160
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
161
161
}
162
162
163
163
/**
@@ -187,12 +187,12 @@ public static function expandDimensionsShorthandProvider(): array
187
187
*/
188
188
public function createBorderShorthand (string $ sCss , string $ sExpected ): void
189
189
{
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 ();
194
194
}
195
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
195
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
196
196
}
197
197
198
198
/**
@@ -215,12 +215,12 @@ public static function createBorderShorthandProvider(): array
215
215
*/
216
216
public function createFontShorthand (string $ sCss , string $ sExpected ): void
217
217
{
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 ();
222
222
}
223
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
223
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
224
224
}
225
225
226
226
/**
@@ -255,12 +255,12 @@ public static function createFontShorthandProvider(): array
255
255
*/
256
256
public function createDimensionsShorthand (string $ sCss , string $ sExpected ): void
257
257
{
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 ();
262
262
}
263
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
263
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
264
264
}
265
265
266
266
/**
@@ -290,12 +290,12 @@ public static function createDimensionsShorthandProvider(): array
290
290
*/
291
291
public function createBackgroundShorthand (string $ sCss , string $ sExpected ): void
292
292
{
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 ();
297
297
}
298
- self ::assertSame (\trim ((string ) $ oDoc ), $ sExpected );
298
+ self ::assertSame (\trim ((string ) $ document ), $ sExpected );
299
299
}
300
300
301
301
/**
@@ -337,20 +337,20 @@ public static function createBackgroundShorthandProvider(): array
337
337
public function overrideRules (): void
338
338
{
339
339
$ 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 ());
354
354
}
355
355
356
356
/**
@@ -359,43 +359,43 @@ public function overrideRules(): void
359
359
public function ruleInsertion (): void
360
360
{
361
361
$ 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 ];
366
366
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 ];
370
370
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 ];
374
374
375
- $ oBefore = new Rule ('left ' );
376
- $ oBefore ->setValue (new Size (16 , 'em ' ));
375
+ $ leftPrefixRule = new Rule ('left ' );
376
+ $ leftPrefixRule ->setValue (new Size (16 , 'em ' ));
377
377
378
- $ oMiddle = new Rule ('text-align ' );
379
- $ oMiddle ->setValue (new Size (1 ));
378
+ $ textAlignRule = new Rule ('text-align ' );
379
+ $ textAlignRule ->setValue (new Size (1 ));
380
380
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 ' ));
383
383
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 );
387
387
388
- $ aRules = $ oWrapper ->getRules ();
388
+ $ rules = $ wrapper ->getRules ();
389
389
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 ]);
395
395
396
396
self ::assertSame (
397
397
'.wrapper {left: 16em;left: 10px;text-align: 1;text-align: left;border-bottom-width: 1px;} ' ,
398
- $ oDoc ->render ()
398
+ $ document ->render ()
399
399
);
400
400
}
401
401
@@ -407,14 +407,14 @@ public function ruleInsertion(): void
407
407
public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands (): void
408
408
{
409
409
$ 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 ();
413
413
414
- self ::assertCount (1 , $ aDocs );
414
+ self ::assertCount (1 , $ declarationBlocks );
415
415
416
- $ oDeclaration = \array_pop ($ aDocs );
417
- $ oDeclaration ->expandShorthands ();
416
+ $ lastDeclarationBlock = \array_pop ($ declarationBlocks );
417
+ $ lastDeclarationBlock ->expandShorthands ();
418
418
419
419
self ::assertEquals (
420
420
[
@@ -423,7 +423,7 @@ public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands():
423
423
'padding-bottom ' => 'padding-bottom: 5px; ' ,
424
424
'padding-left ' => 'padding-left: 5px; ' ,
425
425
],
426
- \array_map ('strval ' , $ oDeclaration ->getRulesAssoc ())
426
+ \array_map ('strval ' , $ lastDeclarationBlock ->getRulesAssoc ())
427
427
);
428
428
}
429
429
}
0 commit comments