Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Kafka::assertPublishedOn not working when producing batch messages #179

Closed
behzadev opened this issue Mar 2, 2023 · 1 comment · Fixed by #180
Closed

[BUG] Kafka::assertPublishedOn not working when producing batch messages #179

behzadev opened this issue Mar 2, 2023 · 1 comment · Fixed by #180
Assignees

Comments

@behzadev
Copy link
Contributor

behzadev commented Mar 2, 2023

Describe the bug
Kafka::assertPublishedOn works when producing messages but is not working when producing batch messages.

To Reproduce
Produce a message batch and send it, on tests assert that using Kafka::assertPublishedOn('topic', 1), it will fail while Kafka::assertPublished() and Kafka::assertPublishedTimes(1) work. it seems there is a problem with topic name in this situation using Kafka::fake();

Code Examples

$message = new Message(
        headers: ['header-key' => 'header-value'],
        body: ['key' => 'value'],
        key: 'kafka key here'  
);

$messageBatch = new MessageBatch();
$messageBatch->push($message);
$messageBatch->push($message);

$producer = Kafka::publishOn('some-kafka-topic')
        ->withConfigOptions(['key' => 'value']);

$producer->sendBatch($messageBatch);

Kafka::assertPublishedTimes(2); // <====== this works just fine
Kafka::assertPublished(); // <====== this works just fine
Kafka::assertPublishedOnTimes('some-kafka-topic', 2); // <====== this fails
Kafka::assertPublishedOn('some-kafka-topic'); // <====== this fails
@mateusjunges
Copy link
Owner

Hey @behzadev thanks for reporting. Fixed on v1.12.3 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants