Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: test should preserve same serializer rd-kafka
  • Loading branch information
lenchester committed Jul 1, 2025
commit ff9de7f4241fb268f144fbf6814220d476f575b9
3 changes: 1 addition & 2 deletions pkg/rdkafka/RdKafkaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ public static function getLibrdKafkaVersion(): string
}

/**
* @return void
* JsonSerializer should be the default fallback if no serializer is specified
* JsonSerializer should be the default fallback if no serializer is specified.
*/
private function configureSerializer(array $config): void
{
Expand Down
2 changes: 2 additions & 0 deletions pkg/rdkafka/RdKafkaProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function send(Destination $destination, Message $message): void
*/
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
$deliveryDelay = null;

if (null === $deliveryDelay) {
return $this;
}
Expand Down
11 changes: 11 additions & 0 deletions pkg/rdkafka/Tests/RdKafkaContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ public function testShouldUseJsonSerializer()
$this->assertInstanceOf(JsonSerializer::class, $context->getSerializer());
}

public function testShouldPreserveSameSerializerInstanceWhenObjectIsPassed()
{
$serializer = $this->createMock(Serializer::class);

$context = new RdKafkaContext([
'serializer' => $serializer,
]);

$this->assertSame($serializer, $context->getSerializer());
}

public function testShouldThrowExceptionOnInvalidSerializerConfig()
{
$this->expectException(\InvalidArgumentException::class);
Expand Down
Loading