Add error handling and response expectation options to BackgroundSync… #32
infection.yml
on: push
0️⃣ Mutation Testing
1m 43s
Annotations
10 warnings
0️⃣ Mutation Testing:
src/CachingStrategy/AssetCache.php#L45
Escaped Mutant for Mutator "UnwrapRtrim":
@@ @@
public function __construct(ServiceWorker $serviceWorker, #[Autowire(service: 'asset_mapper.public_assets_path_resolver')] PublicAssetsPathResolverInterface $publicAssetsPathResolver, private readonly AssetMapperInterface $assetMapper, private readonly SerializerInterface $serializer, #[Autowire(param: 'kernel.debug')] bool $debug)
{
$this->workbox = $serviceWorker->workbox;
- $this->assetPublicPrefix = rtrim($publicAssetsPathResolver->resolvePublicPath(''), '/');
+ $this->assetPublicPrefix = $publicAssetsPathResolver->resolvePublicPath('');
$options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
if ($debug === true) {
$options |= JSON_PRETTY_PRINT;
|
0️⃣ Mutation Testing:
src/CachingStrategy/GoogleFontCache.php#L55
Escaped Mutant for Mutator "Coalesce":
@@ @@
if ($prefix !== '') {
$prefix .= '-';
}
- $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_STALE_WHILE_REVALIDATE, "({url}) => url.origin === 'https://fonts.googleapis.com'")->withName($prefix . 'google-fonts-stylesheets'), WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({url}) => url.origin === 'https://fonts.gstatic.com'")->withName($prefix . 'google-fonts-webfonts')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($this->workbox->googleFontCache->maxEntries ?? 30, $this->workbox->googleFontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365))];
+ $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_STALE_WHILE_REVALIDATE, "({url}) => url.origin === 'https://fonts.googleapis.com'")->withName($prefix . 'google-fonts-stylesheets'), WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({url}) => url.origin === 'https://fonts.gstatic.com'")->withName($prefix . 'google-fonts-webfonts')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($this->workbox->googleFontCache->maxEntries ?? 30, 60 * 60 * 24 * 365 ?? $this->workbox->googleFontCache->maxAgeInSeconds()))];
$this->logger->debug('Google Fonts cache strategies', ['strategies' => $strategies]);
return $strategies;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/GoogleFontCache.php#L59
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
$prefix .= '-';
}
$strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_STALE_WHILE_REVALIDATE, "({url}) => url.origin === 'https://fonts.googleapis.com'")->withName($prefix . 'google-fonts-stylesheets'), WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({url}) => url.origin === 'https://fonts.gstatic.com'")->withName($prefix . 'google-fonts-webfonts')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($this->workbox->googleFontCache->maxEntries ?? 30, $this->workbox->googleFontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365))];
- $this->logger->debug('Google Fonts cache strategies', ['strategies' => $strategies]);
+ $this->logger->debug('Google Fonts cache strategies', []);
return $strategies;
}
public function setLogger(LoggerInterface $logger): void
|
0️⃣ Mutation Testing:
src/CachingStrategy/GoogleFontCache.php#L63
Escaped Mutant for Mutator "ArrayOneItem":
@@ @@
}
$strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_STALE_WHILE_REVALIDATE, "({url}) => url.origin === 'https://fonts.googleapis.com'")->withName($prefix . 'google-fonts-stylesheets'), WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->googleFontCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, "({url}) => url.origin === 'https://fonts.gstatic.com'")->withName($prefix . 'google-fonts-webfonts')->withPlugin(CacheableResponsePlugin::create(), ExpirationPlugin::create($this->workbox->googleFontCache->maxEntries ?? 30, $this->workbox->googleFontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365))];
$this->logger->debug('Google Fonts cache strategies', ['strategies' => $strategies]);
- return $strategies;
+ return count($strategies) > 1 ? array_slice($strategies, 0, 1, true) : $strategies;
}
public function setLogger(LoggerInterface $logger): void
{
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L38
Escaped Mutant for Mutator "LogicalAnd":
@@ @@
}
public function getCacheStrategies(): array
{
- $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
+ $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled || $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
$this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
return $strategies;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L38
Escaped Mutant for Mutator "LogicalAndNegation":
@@ @@
}
public function getCacheStrategies(): array
{
- $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
+ $strategies = [WorkboxCacheStrategy::create(!($this->workbox->enabled && $this->workbox->imageCache->enabled), true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
$this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
return $strategies;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L39
Escaped Mutant for Mutator "TrueValue":
@@ @@
}
public function getCacheStrategies(): array
{
- $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
+ $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, false, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
$this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
return $strategies;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L46
Escaped Mutant for Mutator "Coalesce":
@@ @@
}
public function getCacheStrategies(): array
{
- $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
+ $strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName('images' ?? $this->workbox->imageCache->cacheName)];
$this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
return $strategies;
}
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L48
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
public function getCacheStrategies(): array
{
$strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
- $this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
+ $this->logger->debug('Image cache strategies', []);
return $strategies;
}
public function setLogger(LoggerInterface $logger): void
|
0️⃣ Mutation Testing:
src/CachingStrategy/ImageCache.php#L52
Escaped Mutant for Mutator "ArrayOneItem":
@@ @@
{
$strategies = [WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->imageCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({request, url}) => (request.destination === 'image' && !url.pathname.startsWith('%s'))", $this->assetPublicPrefix))->withName($this->workbox->imageCache->cacheName ?? 'images')];
$this->logger->debug('Image cache strategies', ['strategies' => $strategies]);
- return $strategies;
+ return count($strategies) > 1 ? array_slice($strategies, 0, 1, true) : $strategies;
}
public function setLogger(LoggerInterface $logger): void
{
|