lamoda / codeception-kafka
This package is abandoned and no longer maintained.
No replacement package was suggested.
Kafka helper for codeception tests
0.0.2
2021-03-02 14:39 UTC
Requires
- php: >=7.1
- ext-rdkafka: ^3 || ^4
- codeception/codeception: ^2.5 | ^3.0 | ^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.13
- kwn/php-rdkafka-stubs: ^1.1.0
This package is auto-updated.
Last update: 2023-05-29 01:40:17 UTC
README
THIS MODULE IS NOT PRODUCTION READY
This extension supports working with Apache Kafka.
Installation
-
Install library
composer require lamoda/codeception-kafka
-
Create message serializer for your data transfer object
namespace Tests\KafkaModule;
use App\EventBus\DtoInterface;
use Lamoda\Codeception\Extension\MessageSerializer\MessageSerializerInterface;
class AcmeMessageSerializer implements MessageSerializerInterface
{
public function serialize($dto): string
{
if (!$dto instanceif DtoInterface) {
throw new \RuntimeException('This value must be an ' . DtoInterface::class);
}
$message = json_encode($dto->toArray());
if (!is_string($message)) {
throw new \RuntimeException(json_last_error(), json_last_error_msg());
}
return $message;
}
}
The default message serializer is Lamoda\Codeception\Extension\MessageSerializer\ArrayMessageSerializer.
- Include to suite and configure
modules: enabled: - \Lamoda\Codeception\Extension\KafkaModule serializer: 'Tests\KafkaModule\AcmeMessageSerializer' config: metadata.broker.list: '192.168.99.100:9092' group.id: 'group_for_tests' topic_config: offset.store.sync.interval.ms: '0' auto.commit.interval.ms: '500' auto.offset.reset: 'smallest'
Development
PHP Coding Standards Fixer
make php-cs-check make php-cs-fix
Tests
Unit
make test-unit