Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusjunges committed Jan 9, 2024
1 parent ffece55 commit 08a02ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/Console/Commands/ConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function handle()
return;
}

$parsedOptions = array_map(fn ($value) => $value === '?' ? null : $value, $this->options());
$parsedOptions = array_map($this->parseOptions(...), $this->options());

$options = new Options($parsedOptions, $this->config);

Expand Down Expand Up @@ -85,4 +85,17 @@ public function handle()

$consumer->consume();
}

private function parseOptions(int|string|null $option): int|string|null
{
if ($option === '?') {
return null;
}

if (is_numeric($option)) {
return (int) $option;
}

return $option;
}
}
2 changes: 1 addition & 1 deletion tests/Consumers/ConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function testCanStopConsumeIfMaxTimeReached()
$this->mockProducer();

$fakeHandler = new CallableConsumer(
function (KafkaConsumerMessage $message) {
function (ConsumerMessage $message) {
sleep(2);
},
[]
Expand Down

0 comments on commit 08a02ae

Please sign in to comment.