Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8dc32f7

Browse filesBrowse files
committed
minor #59451 [AssetMapper] skip test if not supported compressors are available (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [AssetMapper] skip test if not supported compressors are available | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 8208c75 skip test if not supported compressors are available
2 parents a497ae4 + 8208c75 commit 8dc32f7
Copy full SHA for 8dc32f7

File tree

2 files changed

+10
-2
lines changed
Filter options

2 files changed

+10
-2
lines changed

‎src/Symfony/Component/AssetMapper/Path/LocalPublicAssetsFilesystem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Path/LocalPublicAssetsFilesystem.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getDestinationPath(): string
5050
return $this->publicDir;
5151
}
5252

53-
private function compress($targetPath): void
53+
private function compress(string $targetPath): void
5454
{
5555
foreach ($this->extensionsToCompress as $ext) {
5656
if (!str_ends_with($targetPath, ".$ext")) {

‎src/Symfony/Component/AssetMapper/Tests/Compressor/ChainCompressorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Tests/Compressor/ChainCompressorTest.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\AssetMapper\Compressor\BrotliCompressor;
1616
use Symfony\Component\AssetMapper\Compressor\ChainCompressor;
17+
use Symfony\Component\AssetMapper\Compressor\GzipCompressor;
1718
use Symfony\Component\AssetMapper\Compressor\ZstandardCompressor;
1819
use Symfony\Component\Filesystem\Filesystem;
1920

@@ -41,14 +42,21 @@ protected function tearDown(): void
4142

4243
public function testCompress()
4344
{
44-
$extensions = ['gz'];
45+
$extensions = [];
46+
if (null === (new GzipCompressor())->getUnsupportedReason()) {
47+
$extensions[] = 'gz';
48+
}
4549
if (null === (new BrotliCompressor())->getUnsupportedReason()) {
4650
$extensions[] = 'br';
4751
}
4852
if (null === (new ZstandardCompressor())->getUnsupportedReason()) {
4953
$extensions[] = 'zst';
5054
}
5155

56+
if (!$extensions) {
57+
$this->markTestSkipped('No supported compressors available.');
58+
}
59+
5260
$this->filesystem->dumpFile(self::WRITABLE_ROOT.'/foo/bar.js', 'foobar');
5361

5462
(new ChainCompressor())->compress(self::WRITABLE_ROOT.'/foo/bar.js');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.