‪TYPO3CMS  9.5
ResourceCompressorTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
21 
26 {
30  protected ‪$backupEnvironment = true;
31 
35  protected ‪$subject;
36 
40  protected function ‪setUp(): void
41  {
42  parent::setUp();
43  $this->subject = $this->getAccessibleMock(ResourceCompressor::class, ['compressCssFile', 'compressJsFile', 'createMergedCssFile', 'createMergedJsFile', 'getFilenameFromMainDir', 'checkBaseDirectory']);
44  }
45 
49  public function ‪cssFixStatementsDataProvider(): array
50  {
51  return [
52  'nothing to do - no charset/import/namespace' => [
53  'body { background: #ffffff; }',
54  'body { background: #ffffff; }'
55  ],
56  'import in front' => [
57  '@import url(http://www.example.com/css); body { background: #ffffff; }',
58  'LF/* moved by compressor */LF@import url(http://www.example.com/css);LF/* moved by compressor */LFbody { background: #ffffff; }'
59  ],
60  'import in back, without quotes' => [
61  'body { background: #ffffff; } @import url(http://www.example.com/css);',
62  'LF/* moved by compressor */LF@import url(http://www.example.com/css);LF/* moved by compressor */LFbody { background: #ffffff; }'
63  ],
64  'import in back, with double-quotes' => [
65  'body { background: #ffffff; } @import url("http://www.example.com/css");',
66  'LF/* moved by compressor */LF@import url("http://www.example.com/css");LF/* moved by compressor */LFbody { background: #ffffff; }'
67  ],
68  'import in back, with single-quotes' => [
69  'body { background: #ffffff; } @import url(\'http://www.example.com/css\');',
70  'LF/* moved by compressor */LF@import url(\'http://www.example.com/css\');LF/* moved by compressor */LFbody { background: #ffffff; }'
71  ],
72  'import in middle and back, without quotes' => [
73  'body { background: #ffffff; } @import url(http://www.example.com/A); div { background: #000; } @import url(http://www.example.com/B);',
74  'LF/* moved by compressor */LF@import url(http://www.example.com/A);@import url(http://www.example.com/B);LF/* moved by compressor */LFbody { background: #ffffff; } div { background: #000; }'
75  ],
76  'charset declaration is unique' => [
77  'body { background: #ffffff; } @charset "UTF-8"; div { background: #000; }; @charset "UTF-8";',
78  '@charset "UTF-8";LF/* moved by compressor */LFbody { background: #ffffff; } div { background: #000; };'
79  ],
80  'order of charset, namespace and import is correct' => [
81  'body { background: #ffffff; } @charset "UTF-8"; div { background: #000; }; @import "file2.css"; @namespace url(http://www.w3.org/1999/xhtml);',
82  '@charset "UTF-8";LF/* moved by compressor */LF@namespace url(http://www.w3.org/1999/xhtml);LF/* moved by compressor */LF@import "file2.css";LF/* moved by compressor */LFbody { background: #ffffff; } div { background: #000; };'
83  ],
84  ];
85  }
86 
93  public function ‪cssFixStatementsMovesStatementsToTopIfNeeded($input, $expected): void
94  {
95  $result = $this->subject->_call('cssFixStatements', $input);
96  $resultWithReadableLinefeed = str_replace(LF, 'LF', $result);
97  $this->assertEquals($expected, $resultWithReadableLinefeed);
98  }
99 
104  {
105  $fileName = 'fooFile.css';
106  $compressedFileName = $fileName . '.gzip';
107  $testFileFixture = [
108  $fileName => [
109  'file' => $fileName,
110  'compress' => true,
111  ]
112  ];
113  $this->subject->expects($this->once())
114  ->method('compressCssFile')
115  ->with($fileName)
116  ->will($this->returnValue($compressedFileName));
117 
118  $result = $this->subject->compressCssFiles($testFileFixture);
119 
120  $this->assertArrayHasKey($compressedFileName, $result);
121  $this->assertArrayHasKey('compress', $result[$compressedFileName]);
122  $this->assertFalse($result[$compressedFileName]['compress']);
123  }
124 
128  public function ‪compressedJsFileIsFlaggedToNotCompressAgain(): void
129  {
130  $fileName = 'fooFile.js';
131  $compressedFileName = $fileName . '.gzip';
132  $testFileFixture = [
133  $fileName => [
134  'file' => $fileName,
135  'compress' => true,
136  ]
137  ];
138  $this->subject->expects($this->once())
139  ->method('compressJsFile')
140  ->with($fileName)
141  ->will($this->returnValue($compressedFileName));
142 
143  $result = $this->subject->compressJsFiles($testFileFixture);
144 
145  $this->assertArrayHasKey($compressedFileName, $result);
146  $this->assertArrayHasKey('compress', $result[$compressedFileName]);
147  $this->assertFalse($result[$compressedFileName]['compress']);
148  }
149 
154  {
155  $fileName = 'fooFile.css';
156  $concatenatedFileName = 'merged_' . $fileName;
157  $testFileFixture = [
158  $fileName => [
159  'file' => $fileName,
160  'excludeFromConcatenation' => false,
161  'media' => 'all',
162  ]
163  ];
164  $this->subject->expects($this->once())
165  ->method('createMergedCssFile')
166  ->will($this->returnValue($concatenatedFileName));
167 
168  $result = $this->subject->concatenateCssFiles($testFileFixture);
169 
170  $this->assertArrayHasKey($concatenatedFileName, $result);
171  $this->assertArrayHasKey('excludeFromConcatenation', $result[$concatenatedFileName]);
172  $this->assertTrue($result[$concatenatedFileName]['excludeFromConcatenation']);
173  }
174 
178  public function ‪concatenatedCssFilesAreSeparatedByMediaType(): void
179  {
180  $allFileName = 'allFile.css';
181  $screenFileName1 = 'screenFile.css';
182  $screenFileName2 = 'screenFile2.css';
183  $testFileFixture = [
184  $allFileName => [
185  'file' => $allFileName,
186  'excludeFromConcatenation' => false,
187  'media' => 'all',
188  ],
189  // use two screen files to check if they are merged into one, even with a different media type
190  $screenFileName1 => [
191  'file' => $screenFileName1,
192  'excludeFromConcatenation' => false,
193  'media' => 'screen',
194  ],
195  $screenFileName2 => [
196  'file' => $screenFileName2,
197  'excludeFromConcatenation' => false,
198  'media' => 'screen',
199  ],
200  ];
201  $this->subject->expects($this->exactly(2))
202  ->method('createMergedCssFile')
203  ->will($this->onConsecutiveCalls(
204  $this->returnValue('merged_' . $allFileName),
205  $this->returnValue('merged_' . $screenFileName1)
206  ));
207 
208  $result = $this->subject->concatenateCssFiles($testFileFixture);
209 
210  $this->assertEquals([
211  'merged_' . $allFileName,
212  'merged_' . $screenFileName1
213  ], array_keys($result));
214  $this->assertEquals('all', $result['merged_' . $allFileName]['media']);
215  $this->assertEquals('screen', $result['merged_' . $screenFileName1]['media']);
216  }
217 
221  public function ‪concatenatedCssFilesObeyForceOnTopOption(): void
222  {
223  $screen1FileName = 'screen1File.css';
224  $screen2FileName = 'screen2File.css';
225  $screen3FileName = 'screen3File.css';
226  $testFileFixture = [
227  $screen1FileName => [
228  'file' => $screen1FileName,
229  'excludeFromConcatenation' => false,
230  'media' => 'screen',
231  ],
232  $screen2FileName => [
233  'file' => $screen2FileName,
234  'excludeFromConcatenation' => false,
235  'media' => 'screen',
236  ],
237  $screen3FileName => [
238  'file' => $screen3FileName,
239  'excludeFromConcatenation' => false,
240  'forceOnTop' => true,
241  'media' => 'screen',
242  ],
243  ];
244  // Replace mocked method getFilenameFromMainDir by passthrough callback
245  $this->subject->expects($this->any())->method('getFilenameFromMainDir')->willReturnArgument(0);
246  $this->subject->expects($this->once())
247  ->method('createMergedCssFile')
248  ->with($this->equalTo([$screen3FileName, $screen1FileName, $screen2FileName]));
249 
250  $this->subject->concatenateCssFiles($testFileFixture);
251  }
252 
257  {
258  $screen1FileName = 'screen1File.css';
259  $screen2FileName = 'screen2File.css';
260  $screen3FileName = 'screen3File.css';
261  $testFileFixture = [
262  $screen1FileName => [
263  'file' => $screen1FileName,
264  'excludeFromConcatenation' => false,
265  'media' => 'screen',
266  ],
267  $screen2FileName => [
268  'file' => $screen2FileName,
269  'excludeFromConcatenation' => true,
270  'media' => 'screen',
271  ],
272  $screen3FileName => [
273  'file' => $screen3FileName,
274  'excludeFromConcatenation' => false,
275  'media' => 'screen',
276  ],
277  ];
278  $this->subject->expects($this->any())->method('getFilenameFromMainDir')->willReturnArgument(0);
279  $this->subject->expects($this->once())
280  ->method('createMergedCssFile')
281  ->with($this->equalTo([$screen1FileName, $screen3FileName]))
282  ->will($this->returnValue('merged_screen'));
283 
284  $result = $this->subject->concatenateCssFiles($testFileFixture);
285  $this->assertEquals([
286  $screen2FileName,
287  'merged_screen'
288  ], array_keys($result));
289  $this->assertEquals('screen', $result[$screen2FileName]['media']);
290  $this->assertEquals('screen', $result['merged_screen']['media']);
291  }
292 
297  {
298  $fileName = 'fooFile.js';
299  $concatenatedFileName = 'merged_' . $fileName;
300  $testFileFixture = [
301  $fileName => [
302  'file' => $fileName,
303  'excludeFromConcatenation' => false,
304  'section' => 'top',
305  ]
306  ];
307  $this->subject->expects($this->once())
308  ->method('createMergedJsFile')
309  ->will($this->returnValue($concatenatedFileName));
310 
311  $result = $this->subject->concatenateJsFiles($testFileFixture);
312 
313  $this->assertArrayHasKey($concatenatedFileName, $result);
314  $this->assertArrayHasKey('excludeFromConcatenation', $result[$concatenatedFileName]);
315  $this->assertTrue($result[$concatenatedFileName]['excludeFromConcatenation']);
316  }
317 
321  public function ‪concatenateJsFileAsyncDataProvider(): array
322  {
323  return [
324  'all files have no async' => [
325  [
326  [
327  'file' => 'file1.js',
328  'excludeFromConcatenation' => false,
329  'section' => 'top',
330  ],
331  [
332  'file' => 'file2.js',
333  'excludeFromConcatenation' => false,
334  'section' => 'top',
335  ],
336  ],
337  false
338  ],
339  'all files have async false' => [
340  [
341  [
342  'file' => 'file1.js',
343  'excludeFromConcatenation' => false,
344  'section' => 'top',
345  'async' => false,
346  ],
347  [
348  'file' => 'file2.js',
349  'excludeFromConcatenation' => false,
350  'section' => 'top',
351  'async' => false,
352  ],
353  ],
354  false
355  ],
356  'all files have async true' => [
357  [
358  [
359  'file' => 'file1.js',
360  'excludeFromConcatenation' => false,
361  'section' => 'top',
362  'async' => true,
363  ],
364  [
365  'file' => 'file2.js',
366  'excludeFromConcatenation' => false,
367  'section' => 'top',
368  'async' => true,
369  ],
370  ],
371  true
372  ],
373  'one file async true and one file async false' => [
374  [
375  [
376  'file' => 'file1.js',
377  'excludeFromConcatenation' => false,
378  'section' => 'top',
379  'async' => true,
380  ],
381  [
382  'file' => 'file2.js',
383  'excludeFromConcatenation' => false,
384  'section' => 'top',
385  'async' => false,
386  ],
387  ],
388  false
389  ],
390  'one file async true and one file async false but is excluded form concatenation' => [
391  [
392  [
393  'file' => 'file1.js',
394  'excludeFromConcatenation' => false,
395  'section' => 'top',
396  'async' => true,
397  ],
398  [
399  'file' => 'file2.js',
400  'excludeFromConcatenation' => true,
401  'section' => 'top',
402  'async' => false,
403  ],
404  ],
405  true
406  ],
407  'one file async false and one file async true but is excluded form concatenation' => [
408  [
409  [
410  'file' => 'file1.js',
411  'excludeFromConcatenation' => false,
412  'section' => 'top',
413  'async' => false,
414  ],
415  [
416  'file' => 'file2.js',
417  'excludeFromConcatenation' => true,
418  'section' => 'top',
419  'async' => true,
420  ],
421  ],
422  false
423  ],
424  ];
425  }
426 
433  public function ‪concatenateJsFileAddsAsyncPropertyIfAllFilesAreAsync(array $input, bool $expected): void
434  {
435  $concatenatedFileName = 'merged_foo.js';
436  $this->subject->expects($this->once())
437  ->method('createMergedJsFile')
438  ->will($this->returnValue($concatenatedFileName));
439 
440  $result = $this->subject->concatenateJsFiles($input);
441 
442  $this->assertSame($expected, $result[$concatenatedFileName]['async']);
443  }
444 
448  public function ‪calcStatementsDataProvider(): array
449  {
450  return [
451  'simple calc' => [
452  'calc(100% - 3px)',
453  'calc(100% - 3px)',
454  ],
455  'complex calc with parentheses at the beginning' => [
456  'calc((100%/20) - 2*3px)',
457  'calc((100%/20) - 2*3px)',
458  ],
459  'complex calc with parentheses at the end' => [
460  'calc(100%/20 - 2*3px - (200px + 3%))',
461  'calc(100%/20 - 2*3px - (200px + 3%))',
462  ],
463  'complex calc with many parentheses' => [
464  'calc((100%/20) - (2 * (3px - (200px + 3%))))',
465  'calc((100%/20) - (2 * (3px - (200px + 3%))))',
466  ],
467  ];
468  }
469 
476  public function ‪calcFunctionMustRetainWhitespaces($input, $expected): void
477  {
478  $result = $this->subject->_call('compressCssString', $input);
479  $this->assertSame($expected, trim($result));
480  }
481 
485  public function ‪compressCssFileContentDataProvider(): array
486  {
487  $path = __DIR__ . '/ResourceCompressorTest/Fixtures/';
488  return [
489  // File. Tests:
490  // - Stripped comments and white-space.
491  // - Retain white-space in selectors. (http://drupal.org/node/472820)
492  // - Retain pseudo-selectors. (http://drupal.org/node/460448)
493  0 => [
494  $path . 'css_input_without_import.css',
495  $path . 'css_input_without_import.css.optimized.css'
496  ],
497  // File. Tests:
498  // - Retain comment hacks.
499  2 => [
500  $path . 'comment_hacks.css',
501  $path . 'comment_hacks.css.optimized.css'
502  ], /*
503  // File. Tests:
504  // - Any @charset declaration at the beginning of a file should be
505  // removed without breaking subsequent CSS.*/
506  6 => [
507  $path . 'charset_sameline.css',
508  $path . 'charset.css.optimized.css'
509  ],
510  7 => [
511  $path . 'charset_newline.css',
512  $path . 'charset.css.optimized.css'
513  ],
514  ];
515  }
516 
525  public function ‪compressCssFileContent($cssFile, $expected): void
526  {
527  $cssContent = file_get_contents($cssFile);
528  $compressedCss = $this->subject->_call('compressCssString', $cssContent);
529  // we have to fix relative paths, if we aren't working on a file in our target directory
530  $relativeFilename = str_replace(‪Environment::getPublicPath() . '/', '', $cssFile);
531  if (strpos($relativeFilename, $this->subject->_get('targetDirectory')) === false) {
532  $compressedCss = $this->subject->_call('cssFixRelativeUrlPaths', $compressedCss, ‪PathUtility::dirname($relativeFilename) . '/');
533  }
534  $this->assertEquals(file_get_contents($expected), $compressedCss, 'Group of file CSS assets optimized correctly.');
535  }
536 
541  {
542  return [
543  // Get filename using EXT:
544  [
545  'EXT:core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
546  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
547  ],
548  // Get filename using relative path
549  [
550  'typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
551  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
552  ],
553  [
554  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
555  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
556  ],
557  [
558  'typo3temp/assets/compressed/.htaccess',
559  '../typo3temp/assets/compressed/.htaccess'
560  ],
561  // Get filename using absolute path
562  [
563  ‪Environment::getPublicPath() . '/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
564  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
565  ],
566  // Get filename using docroot relative path
567  [
568  '/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
569  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
570  ],
571  ];
572  }
573 
580  public function ‪getFilenamesFromMainDirInBackendContext(string $filename, string $expected)
581  {
582  // getCurrentScript() called by PathUtility::getRelativePathTo() is usually something
583  // like '.../bin/phpunit' in testing context, but we want .../typo3/index.php as entry
584  // script point here to fake the backend call.
585  $bePath = ‪Environment::getBackendPath();
588  true,
589  false,
594  $bePath . '/index.php',
595  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
596  );
597  ‪$subject = $this->getAccessibleMock(ResourceCompressor::class, ['dummy']);
598  ‪$subject->‪setRootPath($bePath . '/');
599  $relativeToRootPath = ‪$subject->_call('getFilenameFromMainDir', $filename);
600  $this->assertSame($expected, $relativeToRootPath);
601  }
602 
607  {
608  return [
609  // Get filename using EXT:
610  [
611  'EXT:core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
612  'typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
613  ],
614  // Get filename using relative path
615  [
616  'typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
617  'typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
618  ],
619  [
620  'typo3temp/assets/compressed/.htaccess',
621  'typo3temp/assets/compressed/.htaccess'
622  ],
623  ];
624  }
625 
632  public function ‪getFilenamesFromMainDirInFrontendContext(string $filename, string $expected)
633  {
634  // getCurrentScript() called by PathUtility::getRelativePathTo() is usually something
635  // like '.../bin/phpunit' in testing context, but we want .../index.php as entry
636  // script point here to fake the frontend call.
637  $fePath = ‪Environment::getPublicPath();
640  true,
641  false,
646  $fePath . '/index.php',
647  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
648  );
649  ‪$subject = $this->getAccessibleMock(ResourceCompressor::class, ['dummy']);
650  ‪$subject->‪setRootPath($fePath . '/');
651  $relativeToRootPath = ‪$subject->_call('getFilenameFromMainDir', $filename);
652  $this->assertSame($expected, $relativeToRootPath);
653  }
654 
656  {
657  $subfolderFake = basename(‪Environment::getPublicPath());
658  return [
659  // Get filename using absolute path
660  [
661  ‪Environment::getPublicPath() . '/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
662  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
663  ],
664  // Get filename using docroot relative path
665  [
666  '/' . $subfolderFake . '/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css',
667  'sysext/core/Tests/Unit/Resource/ResourceCompressorTest/Fixtures/charset.css'
668  ],
669  ];
670  }
671 
678  public function ‪getFilenamesFromMainDirInBackendContextWithSubFolder(string $filename, string $expected): void
679  {
680  // getCurrentScript() called by PathUtility::getRelativePathTo() is usually something
681  // like '.../bin/phpunit' in testing context, but we want .../typo3/index.php as entry
682  // script point here to fake the backend call.
683  $bePath = ‪Environment::getBackendPath();
684  $subfolderFake = basename(‪Environment::getPublicPath());
685  $_SERVER['ORIG_SCRIPT_NAME'] = '/' . $subfolderFake . '/typo3/index.php';
688  true,
689  false,
694  $bePath . '/index.php',
695  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
696  );
697  ‪$subject = $this->getAccessibleMock(ResourceCompressor::class, ['dummy']);
698  ‪$subject->‪setRootPath($bePath . '/');
699  $relativeToRootPath = ‪$subject->_call('getFilenameFromMainDir', $filename);
700  self::assertSame($expected, $relativeToRootPath);
701  }
702 
706  public function ‪deferJavascriptIsNotConcatenated(): void
707  {
708  $fileName = 'fooFile.js';
709  $concatenatedFileName = 'merged_' . $fileName;
710  $testFileFixture = [
711  $fileName => [
712  'file' => $fileName,
713  'defer' => true,
714  'section' => 'top',
715  ]
716  ];
717 
718  $result = $this->subject->concatenateJsFiles($testFileFixture);
719 
720  self::assertArrayNotHasKey($concatenatedFileName, $result);
721  self::assertTrue($result[$fileName]['defer']);
722  }
723 }
‪TYPO3\CMS\Core\Utility\PathUtility
Definition: PathUtility.php:23
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\$backupEnvironment
‪bool $backupEnvironment
Definition: ResourceCompressorTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInBackendContextWithSubFolder
‪getFilenamesFromMainDirInBackendContextWithSubFolder(string $filename, string $expected)
Definition: ResourceCompressorTest.php:676
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\cssFixStatementsDataProvider
‪array cssFixStatementsDataProvider()
Definition: ResourceCompressorTest.php:47
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenatedCssFilesObeyExcludeFromConcatenation
‪concatenatedCssFilesObeyExcludeFromConcatenation()
Definition: ResourceCompressorTest.php:254
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:153
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInBackendContext
‪getFilenamesFromMainDirInBackendContext(string $filename, string $expected)
Definition: ResourceCompressorTest.php:578
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInFrontendContextDataProvider
‪array getFilenamesFromMainDirInFrontendContextDataProvider()
Definition: ResourceCompressorTest.php:604
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenatedCssFilesAreSeparatedByMediaType
‪concatenatedCssFilesAreSeparatedByMediaType()
Definition: ResourceCompressorTest.php:176
‪TYPO3\CMS\Core\Utility\PathUtility\dirname
‪static string dirname($path)
Definition: PathUtility.php:185
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\cssFixStatementsMovesStatementsToTopIfNeeded
‪cssFixStatementsMovesStatementsToTopIfNeeded($input, $expected)
Definition: ResourceCompressorTest.php:91
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\calcStatementsDataProvider
‪array calcStatementsDataProvider()
Definition: ResourceCompressorTest.php:446
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest
Definition: ResourceCompressorTest.php:26
‪TYPO3\CMS\Core\Tests\Unit\Resource
Definition: AbstractFileTest.php:3
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
Definition: BaseTestCase.php:24
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:266
‪TYPO3\CMS\Core\Resource\ResourceCompressor
Definition: ResourceCompressor.php:27
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInBackendContextDataProvider
‪array getFilenamesFromMainDirInBackendContextDataProvider()
Definition: ResourceCompressorTest.php:538
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenateJsFileAsyncDataProvider
‪array concatenateJsFileAsyncDataProvider()
Definition: ResourceCompressorTest.php:319
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\compressCssFileContentDataProvider
‪array compressCssFileContentDataProvider()
Definition: ResourceCompressorTest.php:483
‪TYPO3\CMS\Core\Core\Environment\getContext
‪static ApplicationContext getContext()
Definition: Environment.php:106
‪TYPO3\CMS\Core\Resource\ResourceCompressor\setRootPath
‪setRootPath($rootPath)
Definition: ResourceCompressor.php:91
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenateJsFileAddsAsyncPropertyIfAllFilesAreAsync
‪concatenateJsFileAddsAsyncPropertyIfAllFilesAreAsync(array $input, bool $expected)
Definition: ResourceCompressorTest.php:431
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\calcFunctionMustRetainWhitespaces
‪calcFunctionMustRetainWhitespaces($input, $expected)
Definition: ResourceCompressorTest.php:474
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:142
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\compressCssFileContent
‪compressCssFileContent($cssFile, $expected)
Definition: ResourceCompressorTest.php:523
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenateJsFileIsFlaggedToNotConcatenateAgain
‪concatenateJsFileIsFlaggedToNotConcatenateAgain()
Definition: ResourceCompressorTest.php:294
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\$subject
‪ResourceCompressor PHPUnit_Framework_MockObject_MockObject TYPO3 TestingFramework Core AccessibleObjectInterface $subject
Definition: ResourceCompressorTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInBackendContextInSubfolderDataProvider
‪getFilenamesFromMainDirInBackendContextInSubfolderDataProvider()
Definition: ResourceCompressorTest.php:653
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\deferJavascriptIsNotConcatenated
‪deferJavascriptIsNotConcatenated()
Definition: ResourceCompressorTest.php:704
‪TYPO3\CMS\Core\Core\Environment\initialize
‪static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
Definition: Environment.php:77
‪TYPO3\CMS\Core\Core\Environment\getBackendPath
‪static string getBackendPath()
Definition: Environment.php:223
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\compressedCssFileIsFlaggedToNotCompressAgain
‪compressedCssFileIsFlaggedToNotCompressAgain()
Definition: ResourceCompressorTest.php:101
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\getFilenamesFromMainDirInFrontendContext
‪getFilenamesFromMainDirInFrontendContext(string $filename, string $expected)
Definition: ResourceCompressorTest.php:630
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\setUp
‪setUp()
Definition: ResourceCompressorTest.php:38
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\compressedJsFileIsFlaggedToNotCompressAgain
‪compressedJsFileIsFlaggedToNotCompressAgain()
Definition: ResourceCompressorTest.php:126
‪TYPO3\CMS\Core\Core\Environment\getConfigPath
‪static string getConfigPath()
Definition: Environment.php:183
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenatedCssFileIsFlaggedToNotConcatenateAgain
‪concatenatedCssFileIsFlaggedToNotConcatenateAgain()
Definition: ResourceCompressorTest.php:151
‪TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\concatenatedCssFilesObeyForceOnTopOption
‪concatenatedCssFilesObeyForceOnTopOption()
Definition: ResourceCompressorTest.php:219
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static string getVarPath()
Definition: Environment.php:165