From 414f38247a084fad3dd63b2106968eb119a3d447 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 12 May 2021 08:45:13 -0500 Subject: [PATCH] formatting --- .../Support/Testing/Fakes/BusFake.php | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Illuminate/Support/Testing/Fakes/BusFake.php b/src/Illuminate/Support/Testing/Fakes/BusFake.php index 7af1af159765..3413dc6af824 100644 --- a/src/Illuminate/Support/Testing/Fakes/BusFake.php +++ b/src/Illuminate/Support/Testing/Fakes/BusFake.php @@ -36,18 +36,18 @@ class BusFake implements QueueingDispatcher protected $commands = []; /** - * The commands that have been dispatched after the response has been sent. + * The commands that have been dispatched synchronously. * * @var array */ - protected $commandsAfterResponse = []; + protected $commandsSync = []; /** - * The commands that have been explicitly dispatched synchronously. + * The commands that have been dispatched after the response has been sent. * * @var array */ - protected $commandsSync = []; + protected $commandsAfterResponse = []; /** * The batches that have been dispatched. @@ -136,42 +136,42 @@ public function assertNotDispatched($command, $callback = null) } /** - * Assert if a job was dispatched after the response was sent based on a truth-test callback. + * Assert if a job was explicitly dispatched synchronously based on a truth-test callback. * * @param string|\Closure $command * @param callable|int|null $callback * @return void */ - public function assertDispatchedAfterResponse($command, $callback = null) + public function assertDispatchedSync($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } if (is_numeric($callback)) { - return $this->assertDispatchedAfterResponseTimes($command, $callback); + return $this->assertDispatchedSyncTimes($command, $callback); } PHPUnit::assertTrue( - $this->dispatchedAfterResponse($command, $callback)->count() > 0, - "The expected [{$command}] job was not dispatched for after sending the response." + $this->dispatchedSync($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched synchronously." ); } /** - * Assert if a job was pushed after the response was sent a number of times. + * Assert if a job was pushed synchronously a number of times. * * @param string $command * @param int $times * @return void */ - public function assertDispatchedAfterResponseTimes($command, $times = 1) + public function assertDispatchedSyncTimes($command, $times = 1) { - $count = $this->dispatchedAfterResponse($command)->count(); + $count = $this->dispatchedSync($command)->count(); PHPUnit::assertSame( $times, $count, - "The expected [{$command}] job was pushed {$count} times instead of {$times} times." + "The expected [{$command}] job was synchronously pushed {$count} times instead of {$times} times." ); } @@ -182,55 +182,55 @@ public function assertDispatchedAfterResponseTimes($command, $times = 1) * @param callable|null $callback * @return void */ - public function assertNotDispatchedAfterResponse($command, $callback = null) + public function assertNotDispatchedSync($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } PHPUnit::assertCount( - 0, $this->dispatchedAfterResponse($command, $callback), - "The unexpected [{$command}] job was dispatched for after sending the response." + 0, $this->dispatchedSync($command, $callback), + "The unexpected [{$command}] job was dispatched synchronously." ); } /** - * Assert if a job was explicitly dispatched synchronously based on a truth-test callback. + * Assert if a job was dispatched after the response was sent based on a truth-test callback. * * @param string|\Closure $command * @param callable|int|null $callback * @return void */ - public function assertDispatchedSync($command, $callback = null) + public function assertDispatchedAfterResponse($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } if (is_numeric($callback)) { - return $this->assertDispatchedSyncTimes($command, $callback); + return $this->assertDispatchedAfterResponseTimes($command, $callback); } PHPUnit::assertTrue( - $this->dispatchedSync($command, $callback)->count() > 0, - "The expected [{$command}] job was not dispatched synchronously." + $this->dispatchedAfterResponse($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched for after sending the response." ); } /** - * Assert if a job was pushed synchronously a number of times. + * Assert if a job was pushed after the response was sent a number of times. * * @param string $command * @param int $times * @return void */ - public function assertDispatchedSyncTimes($command, $times = 1) + public function assertDispatchedAfterResponseTimes($command, $times = 1) { - $count = $this->dispatchedSync($command)->count(); + $count = $this->dispatchedAfterResponse($command)->count(); PHPUnit::assertSame( $times, $count, - "The expected [{$command}] job was synchronously pushed {$count} times instead of {$times} times." + "The expected [{$command}] job was pushed {$count} times instead of {$times} times." ); } @@ -241,15 +241,15 @@ public function assertDispatchedSyncTimes($command, $times = 1) * @param callable|null $callback * @return void */ - public function assertNotDispatchedSync($command, $callback = null) + public function assertNotDispatchedAfterResponse($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } PHPUnit::assertCount( - 0, $this->dispatchedSync($command, $callback), - "The unexpected [{$command}] job was dispatched synchronously." + 0, $this->dispatchedAfterResponse($command, $callback), + "The unexpected [{$command}] job was dispatched for after sending the response." ); } @@ -426,15 +426,15 @@ public function dispatched($command, $callback = null) } /** - * Get all of the jobs dispatched after the response was sent matching a truth-test callback. + * Get all of the jobs dispatched synchronously matching a truth-test callback. * * @param string $command * @param callable|null $callback * @return \Illuminate\Support\Collection */ - public function dispatchedAfterResponse(string $command, $callback = null) + public function dispatchedSync(string $command, $callback = null) { - if (! $this->hasDispatchedAfterResponse($command)) { + if (! $this->hasDispatchedSync($command)) { return collect(); } @@ -442,21 +442,21 @@ public function dispatchedAfterResponse(string $command, $callback = null) return true; }; - return collect($this->commandsAfterResponse[$command])->filter(function ($command) use ($callback) { + return collect($this->commandsSync[$command])->filter(function ($command) use ($callback) { return $callback($command); }); } /** - * Get all of the jobs dispatched synchronously matching a truth-test callback. + * Get all of the jobs dispatched after the response was sent matching a truth-test callback. * * @param string $command * @param callable|null $callback * @return \Illuminate\Support\Collection */ - public function dispatchedSync(string $command, $callback = null) + public function dispatchedAfterResponse(string $command, $callback = null) { - if (! $this->hasDispatchedSync($command)) { + if (! $this->hasDispatchedAfterResponse($command)) { return collect(); } @@ -464,7 +464,7 @@ public function dispatchedSync(string $command, $callback = null) return true; }; - return collect($this->commandsSync[$command])->filter(function ($command) use ($callback) { + return collect($this->commandsAfterResponse[$command])->filter(function ($command) use ($callback) { return $callback($command); }); } @@ -503,9 +503,9 @@ public function hasDispatched($command) * @param string $command * @return bool */ - public function hasDispatchedAfterResponse($command) + public function hasDispatchedSync($command) { - return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]); + return isset($this->commandsSync[$command]) && ! empty($this->commandsSync[$command]); } /** @@ -514,9 +514,9 @@ public function hasDispatchedAfterResponse($command) * @param string $command * @return bool */ - public function hasDispatchedSync($command) + public function hasDispatchedAfterResponse($command) { - return isset($this->commandsSync[$command]) && ! empty($this->commandsSync[$command]); + return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]); } /**