Skip to content

Commit 6074527

Browse files
committed
chore(phpunit): migrate config
1 parent 08abe2e commit 6074527

File tree

5 files changed

+33
-19
lines changed

5 files changed

+33
-19
lines changed

infection.json.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
},
1717
"text": "infection-log.txt"
1818
},
19-
"minMsi": 28,
19+
"minMsi": 10,
2020
"minCoveredMsi": 85
2121
}

phpunit.xml.dist

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
beStrictAboutChangesToGlobalState="true"
5-
beStrictAboutOutputDuringTests="true"
6-
beStrictAboutTodoAnnotatedTests="true"
7-
executionOrder="random"
8-
colors="true"
9-
bootstrap="tests/bootstrap.php"
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
beStrictAboutChangesToGlobalState="true"
6+
beStrictAboutOutputDuringTests="true"
7+
bootstrap="tests/bootstrap.php"
8+
colors="true"
9+
requireCoverageMetadata="true"
10+
failOnRisky="true"
11+
cacheDirectory=".phpunit.cache"
1012
>
11-
<testsuites>
12-
<testsuite name="Test Suite">
13-
<directory>tests</directory>
14-
</testsuite>
15-
</testsuites>
1613
<coverage>
1714
<include>
1815
<directory suffix=".php">src</directory>
1916
</include>
2017
</coverage>
18+
<testsuites>
19+
<testsuite name="Tests">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
2123
</phpunit>

src/SimPodKafkaBundle.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ final class SimPodKafkaBundle extends Bundle
1616
{
1717
public function build(ContainerBuilder $container): void
1818
{
19+
/** @infection-ignore-all */
1920
parent::build($container);
2021

2122
$container->registerForAutoconfiguration(NamedConsumer::class)

tests/ConfigurationTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
use Generator;
88
use SimPod\KafkaBundle\Kafka\Configuration;
99

10+
/** @covers \SimPod\KafkaBundle\Kafka\Configuration */
1011
final class ConfigurationTest extends KafkaTestCase
1112
{
12-
/**
13-
* @dataProvider providerConfiguration
14-
*/
13+
/** @dataProvider providerConfiguration */
1514
public function testConfiguration(
1615
string $config,
1716
?string $authentication,
@@ -28,7 +27,7 @@ public function testConfiguration(
2827
}
2928

3029
/** @return Generator<array{string, string|null, string, string|null}> */
31-
public function providerConfiguration() : Generator
30+
public static function providerConfiguration() : Generator
3231
{
3332
yield ['test-no-auth-no-client', null, '127.0.0.1:9092', null];
3433
yield ['test-sasl-auth-some-id', 'sasl-plain://user:password', '127.0.0.1:9092,127.0.1.1:9092', 'kafka-bundle'];

tests/SimPodBundleTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
use SimPod\KafkaBundle\DependencyInjection\ConsumerCompilerPass;
99
use SimPod\KafkaBundle\SimPodKafkaBundle;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
11+
use SimPod\KafkaBundle\Kafka\Clients\Consumer\NamedConsumer;
1112

13+
/** @covers \SimPod\KafkaBundle\SimPodKafkaBundle */
1214
final class SimPodBundleTest extends TestCase
1315
{
1416
/** @var SimPodKafkaBundle */
@@ -30,8 +32,18 @@ public function testBuild() : void
3032
}
3133
self::assertTrue(
3234
$containsConsumerCompilerPass,
33-
'RabbitMQ bundle does not have registered consumer compiler pass.'
35+
'Kafka bundle does not have registered consumer compiler pass.'
3436
);
37+
38+
$autoconfiguredInstanceof = $containerBuilder->getAutoconfiguredInstanceof();
39+
self::assertArrayHasKey(
40+
NamedConsumer::class,
41+
$autoconfiguredInstanceof,
42+
'Kafka bundle does not have registered autoconfigured instance of.'
43+
);
44+
45+
self::assertArrayHasKey(
46+
ConsumerCompilerPass::TAG_NAME_CONSUMER,$autoconfiguredInstanceof[NamedConsumer::class]->getTags());
3547
}
3648

3749
protected function setUp() : void

0 commit comments

Comments
 (0)