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