Skip to content

Commit

Permalink
Add consumer key to checker
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhukV committed Feb 22, 2024
1 parent a68b185 commit ef57c1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Command/RunConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int

if ($input->getOption('dry-run')) {
$checker = $this->runCheckerRegistry->get($consumerKey);
$checker->checkBeforeRun();
$checker->checkBeforeRun($consumerKey);

return 0;
}

try {
$checker = $this->runCheckerRegistry->get($consumerKey);
$checker->checkBeforeRun();
$checker->checkBeforeRun($consumerKey);
} catch (RunConsumerCheckerNotFoundException) {
// Normal flow. Checker not found.
}
Expand Down
4 changes: 3 additions & 1 deletion src/Consumer/Checker/RunConsumerCheckerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ interface RunConsumerCheckerInterface
/**
* Call to this method before run consumer.
*
* @param string $consumer
*
* @throws CannotRunConsumerException
*/
public function checkBeforeRun(): void;
public function checkBeforeRun(string $consumer): void;
}
4 changes: 3 additions & 1 deletion tests/Unit/Command/RunConsumerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ private function configureChecker(string $key, ?\Throwable $error): void
{
$checker = $this->createMock(RunConsumerCheckerInterface::class);

$matcher = $checker->expects(self::once())->method('checkBeforeRun');
$matcher = $checker->expects(self::once())
->method('checkBeforeRun')
->with($key);

if ($error) {
$matcher->willThrowException($error);
Expand Down

0 comments on commit ef57c1f

Please sign in to comment.