Add display of preloaded URLs in ServiceWorker tab (#212) #17
infection.yml
on: push
0️⃣ Mutation Testing
2m 19s
Annotations
10 warnings
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L68
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
$this->logger->debug('Getting cache strategies for fonts');
$urls = json_decode($this->serializer->serialize($this->getFonts(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
$maxEntries = count($urls) + ($this->workbox->fontCache->maxEntries ?? 60);
- $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
+ $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 364));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/AssetCache.php#L45
Escaped Mutant for Mutator "BitwiseOr":
--- Original
+++ New
@@ @@
{
$this->workbox = $serviceWorker->workbox;
$this->assetPublicPrefix = rtrim($publicAssetsPathResolver->resolvePublicPath(''), '/');
- $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
+ $options = JSON_UNESCAPED_SLASHES & JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
if ($debug === true) {
$options |= JSON_PRETTY_PRINT;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L68
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
$this->logger->debug('Getting cache strategies for fonts');
$urls = json_decode($this->serializer->serialize($this->getFonts(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
$maxEntries = count($urls) + ($this->workbox->fontCache->maxEntries ?? 60);
- $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
+ $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 366));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L68
Escaped Mutant for Mutator "Multiplication":
--- Original
+++ New
@@ @@
$this->logger->debug('Getting cache strategies for fonts');
$urls = json_decode($this->serializer->serialize($this->getFonts(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
$maxEntries = count($urls) + ($this->workbox->fontCache->maxEntries ?? 60);
- $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
+ $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 / 365));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L68
Escaped Mutant for Mutator "Coalesce":
--- Original
+++ New
@@ @@
$this->logger->debug('Getting cache strategies for fonts');
$urls = json_decode($this->serializer->serialize($this->getFonts(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
$maxEntries = count($urls) + ($this->workbox->fontCache->maxEntries ?? 60);
- $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, $this->workbox->fontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
+ $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->fontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({request}) => request.destination === 'font'")->withName($this->workbox->fontCache->cacheName ?? 'fonts')->withMethod('GET')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($maxEntries, 60 * 60 * 24 * 365 ?? $this->workbox->fontCache->maxAgeInSeconds()));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L74
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
- $this->logger->debug('Font cache strategy', ['strategy' => $strategy]);
+ $this->logger->debug('Font cache strategy', []);
return [$strategy];
}
public function setLogger(LoggerInterface $logger): void
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L78
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
$strategy = $strategy->withPreloadUrl(...$urls);
}
$this->logger->debug('Font cache strategy', ['strategy' => $strategy]);
- return [$strategy];
+ return [];
}
public function setLogger(LoggerInterface $logger): void
{
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L93
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
{
$fonts = [];
foreach ($this->assetMapper->allAssets() as $asset) {
- if (preg_match($this->workbox->fontCache->regex, $asset->sourcePath) === 1) {
+ if (preg_match($this->workbox->fontCache->regex, $asset->sourcePath) === 2) {
$fonts[] = $asset->publicPath;
}
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L93
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
{
$fonts = [];
foreach ($this->assetMapper->allAssets() as $asset) {
- if (preg_match($this->workbox->fontCache->regex, $asset->sourcePath) === 1) {
+ if (preg_match($this->workbox->fontCache->regex, $asset->sourcePath) !== 1) {
$fonts[] = $asset->publicPath;
}
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/FontCache.php#L97
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
$fonts[] = $asset->publicPath;
}
}
- $this->logger->debug('Preloading fonts', ['fonts' => $fonts]);
+ $this->logger->debug('Preloading fonts', []);
return $fonts;
}
}
|