Skip to content

Commit

Permalink
fix(Queue): Add missing $method parameter to RunJobActionContract
Browse files Browse the repository at this point in the history
  • Loading branch information
pionl committed Feb 28, 2024
1 parent 6fc5833 commit 28cfde8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Queue/Contracts/RunJobActionContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ interface RunJobActionContract
*
* @return mixed Returns the result of the job
*/
public function execute(Job $job, ?Command $command = null): mixed;
public function execute(Job $job, ?Command $command = null, string $method = null): mixed;
}
5 changes: 3 additions & 2 deletions src/Testing/Queue/Contracts/RunJobActionContractAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ public function __construct(array $execute = [])
$this->setExpectations(RunJobActionContractExpectation::class, $execute);
}

public function execute(Job $job, Command $command = null): mixed
public function execute(Job $job, Command $command = null, string $method = null): mixed
{
$_expectation = $this->getExpectation(RunJobActionContractExpectation::class);
$_message = $this->getDebugMessage();

Assert::assertEquals($_expectation->job, $job, $_message);
Assert::assertEquals($_expectation->command, $command, $_message);
Assert::assertEquals($_expectation->method, $method, $_message);

if (is_callable($_expectation->_hook)) {
call_user_func($_expectation->_hook, $job, $command, $_expectation);
call_user_func($_expectation->_hook, $job, $command, $method, $_expectation);
}

return $_expectation->return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
final class RunJobActionContractExpectation
{
/**
* @param Closure(Job, Command, self):void|null $_hook
* @param Closure(Job, Command, string, self):void|null $_hook
*/
public function __construct(
public readonly mixed $return,
public readonly Job $job,
public readonly ?Command $command = null,
public readonly ?string $method = null,
public readonly ?Closure $_hook = null,
) {
}
Expand Down

0 comments on commit 28cfde8

Please sign in to comment.