Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 7, 2020
1 parent 5c5c310 commit f1b8cac
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/Illuminate/Support/Testing/Fakes/BusFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,29 +185,19 @@ public function assertNotDispatchedAfterResponse($command, $callback = null)
}

/**
* Assert if a batch was dispatched based on a truth-test callback.
* Assert if a chain of jobs was dispatched.
*
* @param callable $callback
* @return void
*/
public function assertBatched(callable $callback)
{
PHPUnit::assertTrue(
$this->batched($callback)->count() > 0,
'The expected batch was not dispatched.'
);
}

/**
* Assert if a job was dispatched based on a truth-test callback.
*
* @param string|\Closure $command
* @param array $expectedChain
* @param callable|null $callback
* @return void
*/
public function assertDispatchedWithChain($command, $expectedChain = [], $callback = null)
public function assertChained(array $expectedChain = [])
{
$command = $expectedChain[0];

$expectedChain = array_slice($expectedChain, 1);

$callback = null;

if ($command instanceof Closure) {
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
}
Expand Down Expand Up @@ -306,6 +296,20 @@ protected function isChainOfObjects($chain)
});
}

/**
* Assert if a batch was dispatched based on a truth-test callback.
*
* @param callable $callback
* @return void
*/
public function assertBatched(callable $callback)
{
PHPUnit::assertTrue(
$this->batched($callback)->count() > 0,
'The expected batch was not dispatched.'
);
}

/**
* Get all of the jobs matching a truth-test callback.
*
Expand Down

0 comments on commit f1b8cac

Please sign in to comment.