Refactor normalization methods for consistency and clarity. (#257) #34
infection.yml
on: push
0️⃣ Mutation Testing
3m 19s
Annotations
11 warnings
0️⃣ Mutation Testing
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
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('%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/AssetCache.php#L47
Escaped Mutant for Mutator "Identical":
@@ @@
$this->workbox = $serviceWorker->workbox;
$this->assetPublicPrefix = rtrim($publicAssetsPathResolver->resolvePublicPath(''), '/');
$options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
- if ($debug === true) {
+ if ($debug !== true) {
$options |= JSON_PRETTY_PRINT;
}
$this->jsonOptions = $options;
|
0️⃣ Mutation Testing:
src/CachingStrategy/AssetCache.php#L58
Escaped Mutant for Mutator "ArrayItem":
@@ @@
public function getCacheStrategies(): array
{
$this->logger->debug('Getting cache strategies for assets');
- $urls = json_decode($this->serializer->serialize($this->getAssets(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
+ $urls = json_decode($this->serializer->serialize($this->getAssets(), 'json', [JsonEncode::OPTIONS > $this->jsonOptions]), true);
$strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->assetCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({url}) => url.pathname.startsWith('%s')", $this->assetPublicPrefix))->withName($this->workbox->assetCache->cacheName)->withPlugin(ExpirationPlugin::create(count($this->getAssets()) * 2, $this->workbox->assetCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
|
0️⃣ Mutation Testing:
src/CachingStrategy/AssetCache.php#L62
Escaped Mutant for Mutator "LogicalAnd":
@@ @@
{
$this->logger->debug('Getting cache strategies for assets');
$urls = json_decode($this->serializer->serialize($this->getAssets(), 'json', [JsonEncode::OPTIONS => $this->jsonOptions]), true);
- $strategy = WorkboxCacheStrategy::create($this->workbox->enabled && $this->workbox->assetCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({url}) => url.pathname.startsWith('%s')", $this->assetPublicPrefix))->withName($this->workbox->assetCache->cacheName)->withPlugin(ExpirationPlugin::create(count($this->getAssets()) * 2, $this->workbox->assetCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
+ $strategy = WorkboxCacheStrategy::create($this->workbox->enabled || $this->workbox->assetCache->enabled, true, CacheStrategyInterface::STRATEGY_CACHE_FIRST, sprintf("({url}) => url.pathname.startsWith('%s')", $this->assetPublicPrefix))->withName($this->workbox->assetCache->cacheName)->withPlugin(ExpirationPlugin::create(count($this->getAssets()) * 2, $this->workbox->assetCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365));
if (count($urls) > 0) {
$strategy = $strategy->withPreloadUrl(...$urls);
}
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L49
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
}
protected function configure(): void
{
- $this->addArgument('source', InputArgument::REQUIRED, 'The source image or an asset logical path', null, ['images/logo.svg', '/home/foo/projetA/favicon.png']);
+ $this->addArgument('source', InputArgument::REQUIRED, 'The source image or an asset logical path', null, ['/home/foo/projetA/favicon.png']);
$this->addOption('output', 'o', InputOption::VALUE_OPTIONAL, 'The output directory', sprintf('%s/assets/icons/', $this->projectDir));
$this->addOption('filename', null, InputOption::VALUE_OPTIONAL, 'The output directory', 'icon');
$this->addOption('format', 'f', InputOption::VALUE_OPTIONAL, 'The format of the icons', 'png', ['png', 'jpg', 'webp']);
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L71
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
$this->addOption('output', 'o', InputOption::VALUE_OPTIONAL, 'The output directory', sprintf('%s/assets/icons/', $this->projectDir));
$this->addOption('filename', null, InputOption::VALUE_OPTIONAL, 'The output directory', 'icon');
$this->addOption('format', 'f', InputOption::VALUE_OPTIONAL, 'The format of the icons', 'png', ['png', 'jpg', 'webp']);
- $this->addArgument('sizes', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The sizes of the icons', ['16', '32', '48', '96', '144', '180', '256', '512', '1024']);
+ $this->addArgument('sizes', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The sizes of the icons', ['32', '48', '96', '144', '180', '256', '512', '1024']);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L78
Escaped Mutant for Mutator "MethodCallRemoval":
@@ @@
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
- $io->title('PWA Icons Generator');
+
if ($this->imageProcessor === null) {
$io->error('The image processor is not enabled.');
return self::FAILURE;
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L85
Escaped Mutant for Mutator "CastString":
@@ @@
return self::FAILURE;
}
$source = $input->getArgument('source');
- $dest = rtrim((string) $input->getOption('output'), '/');
+ $dest = rtrim($input->getOption('output'), '/');
$filename = $input->getOption('filename');
$format = $input->getOption('format');
if (!is_string($format)) {
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L100
Escaped Mutant for Mutator "LogicalNot":
@@ @@
$io->info('The source image does not exist.');
return self::FAILURE;
}
- if (!$this->filesystem->exists($dest)) {
+ if ($this->filesystem->exists($dest)) {
$io->info('The output directory does not exist. It will be created.');
$this->filesystem->mkdir($dest);
}
|
0️⃣ Mutation Testing:
src/Command/CreateIconsCommand.php#L101
Escaped Mutant for Mutator "MethodCallRemoval":
@@ @@
return self::FAILURE;
}
if (!$this->filesystem->exists($dest)) {
- $io->info('The output directory does not exist. It will be created.');
+
$this->filesystem->mkdir($dest);
}
$generatedIcons = [];
|