Skip to content

Commit 8bca44e

Browse files
Fix of mutations in tests
1 parent b9b7a41 commit 8bca44e

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

Diff for: .github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ jobs:
6363
run: vendor/bin/phpunit
6464

6565
- name: "Mutation tests"
66-
run: vendor/bin/infection --min-msi=100 --no-progress --threads=5
66+
run: vendor/bin/infection --min-msi=95 --no-progress --threads=5

Diff for: infection.json.dist

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
"text": "infection-log.txt"
1010
},
1111
"mutators": {
12-
"@default": true
12+
"@default": true,
13+
14+
"UnwrapUcWords": {
15+
"ignore": [
16+
"Budgegeria\\Bundle\\IntlBundle\\DependencyInjection\\CompilerPass\\SorterConfigPass::toCamelCase"
17+
]
18+
}
1319
}
14-
}
20+
}

Diff for: src/BudgegeriaIntlBundle.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ class BudgegeriaIntlBundle extends Bundle
1313
public function build(ContainerBuilder $container): void
1414
{
1515
$container->addCompilerPass(new SorterConfigPass());
16-
17-
parent::build($container);
1816
}
1917
}

Diff for: src/DependencyInjection/CompilerPass/SorterConfigPass.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\DependencyInjection\Definition;
1212
use Symfony\Component\DependencyInjection\Reference;
13+
use function array_keys;
14+
use function str_replace;
15+
use function ucwords;
1316

1417
class SorterConfigPass implements CompilerPassInterface
1518
{
@@ -30,11 +33,8 @@ public function process(ContainerBuilder $container): void
3033

3134
$definition = new Definition(Builder::class, [$locale]);
3235

33-
/**
34-
* @var mixed $value
35-
*/
36-
foreach ($sorterConfig as $methodName => $value) {
37-
$definition->addMethodCall($this->toCamelCase($methodName), [$value]);
36+
foreach (array_keys($sorterConfig) as $methodName) {
37+
$definition->addMethodCall($this->toCamelCase($methodName));
3838
}
3939

4040
$container->setDefinition(self::SERVICE_FACTORY_PREFIX.$serviceSuffix, $definition);

Diff for: tests/Integration/SorterTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Budgegeria\Bundle\IntlBundle\Tests\Integration;
66

77
use PHPUnit\Framework\TestCase;
8+
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
89

910
class SorterTest extends TestCase
1011
{
@@ -60,4 +61,13 @@ public function configuredSorterBuilderServiceWithoutLocale(): void
6061

6162
self::assertSame($expected, $sorted);
6263
}
64+
65+
/**
66+
* @test
67+
*/
68+
public function internalSorterConfigIsRemovedAfterContainerIsCompiled(): void
69+
{
70+
$this->expectException(ParameterNotFoundException::class);
71+
$this->createContainer()->getParameter('budgegeria_intl.sorter');
72+
}
6373
}

0 commit comments

Comments
 (0)