code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function decrementPendingJobs(string $jobId) { // }
Decrement the pending jobs for the batch. @param string $jobId @return void
decrementPendingJobs
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BatchFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BatchFake.php
MIT
public function recordFailedJob(string $jobId, $e) { // }
Record that a job within the batch failed to finish successfully, executing any callbacks if necessary. @param string $jobId @param \Throwable $e @return void
recordFailedJob
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BatchFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BatchFake.php
MIT
public function deleted() { return $this->deleted; }
Determine if the batch has been deleted. @return bool
deleted
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BatchFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BatchFake.php
MIT
protected function assertSentTimes($mailable, $times = 1) { $count = $this->sent($mailable)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$mailable}] mailable was sent {$count} times instead of {$times} times." ); }
Assert if a mailable was sent a number of times. @param string $mailable @param int $times @return void
assertSentTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertNotOutgoing($mailable, $callback = null) { $this->assertNotSent($mailable, $callback); $this->assertNotQueued($mailable, $callback); }
Determine if a mailable was not sent or queued to be sent based on a truth-test callback. @param string|\Closure $mailable @param callable|null $callback @return void
assertNotOutgoing
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertNothingOutgoing() { $this->assertNothingSent(); $this->assertNothingQueued(); }
Assert that no mailables were sent or queued to be sent. @return void
assertNothingOutgoing
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertNothingSent() { $mailableNames = (new Collection($this->mailables))->map( fn ($mailable) => get_class($mailable) )->join("\n- "); PHPUnit::assertEmpty($this->mailables, "The following mailables were sent unexpectedly:\n\n- $mailableNames\n"); }
Assert that no mailables were sent. @return void
assertNothingSent
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
protected function assertQueuedTimes($mailable, $times = 1) { $count = $this->queued($mailable)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$mailable}] mailable was queued {$count} times instead of {$times} times." ); }
Assert if a mailable was queued a number of times. @param string $mailable @param int $times @return void
assertQueuedTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertNothingQueued() { $mailableNames = (new Collection($this->queuedMailables))->map( fn ($mailable) => get_class($mailable) )->join("\n- "); PHPUnit::assertEmpty($this->queuedMailables, "The following mailables were queued unexpectedly:\n\n- $mailableNames\n"); }
Assert that no mailables were queued. @return void
assertNothingQueued
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertSentCount($count) { $total = (new Collection($this->mailables))->count(); PHPUnit::assertSame( $count, $total, "The total number of mailables sent was {$total} instead of {$count}." ); }
Assert the total number of mailables that were sent. @param int $count @return void
assertSentCount
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertQueuedCount($count) { $total = (new Collection($this->queuedMailables))->count(); PHPUnit::assertSame( $count, $total, "The total number of mailables queued was {$total} instead of {$count}." ); }
Assert the total number of mailables that were queued. @param int $count @return void
assertQueuedCount
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function assertOutgoingCount($count) { $total = (new Collection($this->mailables)) ->concat($this->queuedMailables) ->count(); PHPUnit::assertSame( $count, $total, "The total number of outgoing mailables was {$total} instead of {$count}." ); }
Assert the total number of mailables that were sent or queued. @param int $count @return void
assertOutgoingCount
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function hasSent($mailable) { return $this->mailablesOf($mailable)->count() > 0; }
Determine if the given mailable has been sent. @param string $mailable @return bool
hasSent
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function hasQueued($mailable) { return $this->queuedMailablesOf($mailable)->count() > 0; }
Determine if the given mailable has been queued. @param string $mailable @return bool
hasQueued
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
protected function mailablesOf($type) { return (new Collection($this->mailables))->filter(fn ($mailable) => $mailable instanceof $type); }
Get all of the mailed mailables for a given type. @param string $type @return \Illuminate\Support\Collection
mailablesOf
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function to($users) { return (new PendingMailFake($this))->to($users); }
Begin the process of mailing a mailable class instance. @param mixed $users @return \Illuminate\Mail\PendingMail
to
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function raw($text, $callback) { // }
Send a new message with only a raw text part. @param string $text @param \Closure|string $callback @return void
raw
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function send($view, array $data = [], $callback = null) { return $this->sendMail($view, $view instanceof ShouldQueue); }
Send a new message using a view. @param \Illuminate\Contracts\Mail\Mailable|string|array $view @param array $data @param \Closure|string|null $callback @return mixed|void
send
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function sendNow($mailable, array $data = [], $callback = null) { $this->sendMail($mailable, shouldQueue: false); }
Send a new message synchronously using a view. @param \Illuminate\Contracts\Mail\Mailable|string|array $mailable @param array $data @param \Closure|string|null $callback @return void
sendNow
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
protected function sendMail($view, $shouldQueue = false) { if (! $view instanceof Mailable) { return; } $view->mailer($this->currentMailer); if ($shouldQueue) { return $this->queue($view); } $this->currentMailer = null; $this->mailables[] = $view; }
Send a new message using a view. @param \Illuminate\Contracts\Mail\Mailable|string|array $view @param bool $shouldQueue @return mixed|void
sendMail
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function queue($view, $queue = null) { if (! $view instanceof Mailable) { return; } $view->mailer($this->currentMailer); $this->currentMailer = null; $this->queuedMailables[] = $view; }
Queue a new message for sending. @param \Illuminate\Contracts\Mail\Mailable|string|array $view @param string|null $queue @return mixed
queue
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function later($delay, $view, $queue = null) { $this->queue($view, $queue); }
Queue a new e-mail message for sending after (n) seconds. @param \DateTimeInterface|\DateInterval|int $delay @param \Illuminate\Contracts\Mail\Mailable|string|array $view @param string|null $queue @return mixed
later
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
protected function prepareMailableAndCallback($mailable, $callback) { if ($mailable instanceof Closure) { return [$this->firstClosureParameterType($mailable), $mailable]; } return [$mailable, $callback]; }
Infer mailable class using reflection if a typehinted closure is passed to assertion. @param string|\Closure $mailable @param callable|null $callback @return array
prepareMailableAndCallback
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function __call($method, $parameters) { return $this->forwardCallTo($this->manager, $method, $parameters); }
Handle dynamic method calls to the mailer. @param string $method @param array $parameters @return mixed
__call
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/MailFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/MailFake.php
MIT
public function __construct(BusFake $bus, Collection $jobs) { $this->bus = $bus; $this->jobs = $jobs; }
Create a new pending batch instance. @param \Illuminate\Support\Testing\Fakes\BusFake $bus @param \Illuminate\Support\Collection $jobs
__construct
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php
MIT
public function dispatchAfterResponse() { return $this->bus->recordPendingBatch($this); }
Dispatch the batch after the response is sent to the browser. @return \Illuminate\Bus\Batch
dispatchAfterResponse
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php
MIT
public function __construct(QueueingDispatcher $dispatcher, $jobsToFake = [], ?BatchRepository $batchRepository = null) { $this->dispatcher = $dispatcher; $this->jobsToFake = Arr::wrap($jobsToFake); $this->batchRepository = $batchRepository ?: new BatchRepositoryFake; }
Create a new bus fake instance. @param \Illuminate\Contracts\Bus\QueueingDispatcher $dispatcher @param array|string $jobsToFake @param \Illuminate\Bus\BatchRepository|null $batchRepository
__construct
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function except($jobsToDispatch) { $this->jobsToDispatch = array_merge($this->jobsToDispatch, Arr::wrap($jobsToDispatch)); return $this; }
Specify the jobs that should be dispatched instead of faked. @param array|string $jobsToDispatch @return $this
except
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatched($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } if (is_numeric($callback)) { return $this->assertDispatchedTimes($command, $callback); } PHPUnit::assertTrue( $this->dispatched($command, $callback)->count() > 0 || $this->dispatchedAfterResponse($command, $callback)->count() > 0 || $this->dispatchedSync($command, $callback)->count() > 0, "The expected [{$command}] job was not dispatched." ); }
Assert if a job was dispatched based on a truth-test callback. @param string|\Closure $command @param callable|int|null $callback @return void
assertDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedTimes($command, $times = 1) { $callback = null; if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } $count = $this->dispatched($command, $callback)->count() + $this->dispatchedAfterResponse($command, $callback)->count() + $this->dispatchedSync($command, $callback)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$command}] job was pushed {$count} times instead of {$times} times." ); }
Assert if a job was pushed a number of times. @param string|\Closure $command @param int $times @return void
assertDispatchedTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertNotDispatched($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } PHPUnit::assertTrue( $this->dispatched($command, $callback)->count() === 0 && $this->dispatchedAfterResponse($command, $callback)->count() === 0 && $this->dispatchedSync($command, $callback)->count() === 0, "The unexpected [{$command}] job was dispatched." ); }
Determine if a job was dispatched based on a truth-test callback. @param string|\Closure $command @param callable|null $callback @return void
assertNotDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertNothingDispatched() { $commandNames = implode("\n- ", array_keys($this->commands)); PHPUnit::assertEmpty($this->commands, "The following jobs were dispatched unexpectedly:\n\n- $commandNames\n"); }
Assert that no jobs were dispatched. @return void
assertNothingDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedSync($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } if (is_numeric($callback)) { return $this->assertDispatchedSyncTimes($command, $callback); } PHPUnit::assertTrue( $this->dispatchedSync($command, $callback)->count() > 0, "The expected [{$command}] job was not dispatched synchronously." ); }
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
assertDispatchedSync
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedSyncTimes($command, $times = 1) { $callback = null; if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } $count = $this->dispatchedSync($command, $callback)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$command}] job was synchronously pushed {$count} times instead of {$times} times." ); }
Assert if a job was pushed synchronously a number of times. @param string|\Closure $command @param int $times @return void
assertDispatchedSyncTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedAfterResponse($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } if (is_numeric($callback)) { return $this->assertDispatchedAfterResponseTimes($command, $callback); } PHPUnit::assertTrue( $this->dispatchedAfterResponse($command, $callback)->count() > 0, "The expected [{$command}] job was not dispatched after sending the response." ); }
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
assertDispatchedAfterResponse
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedAfterResponseTimes($command, $times = 1) { $callback = null; if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } $count = $this->dispatchedAfterResponse($command, $callback)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$command}] job was pushed {$count} times instead of {$times} times." ); }
Assert if a job was pushed after the response was sent a number of times. @param string|\Closure $command @param int $times @return void
assertDispatchedAfterResponseTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertNothingChained() { $this->assertNothingDispatched(); }
Assert no chained jobs was dispatched. @return void
assertNothingChained
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
protected function resetChainPropertiesToDefaults($job) { return tap(clone $job, function ($job) { $job->chainConnection = null; $job->chainQueue = null; $job->chainCatchCallbacks = null; $job->chained = []; }); }
Reset the chain properties to their default values on the job. @param mixed $job @return mixed
resetChainPropertiesToDefaults
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertDispatchedWithoutChain($command, $callback = null) { if ($command instanceof Closure) { [$command, $callback] = [$this->firstClosureParameterType($command), $command]; } PHPUnit::assertTrue( $this->dispatched($command, $callback)->isNotEmpty(), "The expected [{$command}] job was not dispatched." ); $this->assertDispatchedWithChainOfObjects($command, [], $callback); }
Assert if a job was dispatched with an empty chain based on a truth-test callback. @param string|\Closure $command @param callable|null $callback @return void
assertDispatchedWithoutChain
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function chainedBatch(Closure $callback) { return new ChainedBatchTruthTest($callback); }
Create a new assertion about a chained batch. @param \Closure $callback @return \Illuminate\Support\Testing\Fakes\ChainedBatchTruthTest
chainedBatch
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertBatched(callable $callback) { PHPUnit::assertTrue( $this->batched($callback)->count() > 0, 'The expected batch was not dispatched.' ); }
Assert if a batch was dispatched based on a truth-test callback. @param callable $callback @return void
assertBatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertBatchCount($count) { PHPUnit::assertCount( $count, $this->batches, ); }
Assert the number of batches that have been dispatched. @param int $count @return void
assertBatchCount
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertNothingBatched() { $jobNames = (new Collection($this->batches)) ->map(fn ($batch) => $batch->jobs->map(fn ($job) => get_class($job))) ->flatten() ->join("\n- "); PHPUnit::assertEmpty($this->batches, "The following batched jobs were dispatched unexpectedly:\n\n- $jobNames\n"); }
Assert that no batched jobs were dispatched. @return void
assertNothingBatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function assertNothingPlaced() { $this->assertNothingDispatched(); $this->assertNothingBatched(); }
Assert that no jobs were dispatched, chained, or batched. @return void
assertNothingPlaced
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function batched(callable $callback) { if (empty($this->batches)) { return new Collection; } return (new Collection($this->batches))->filter(fn ($batch) => $callback($batch)); }
Get all of the pending batches matching a truth-test callback. @param callable $callback @return \Illuminate\Support\Collection
batched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function hasDispatched($command) { return isset($this->commands[$command]) && ! empty($this->commands[$command]); }
Determine if there are any stored commands for a given class. @param string $command @return bool
hasDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function dispatchNow($command, $handler = null) { if ($this->shouldFakeJob($command)) { $this->commands[get_class($command)][] = $this->getCommandRepresentation($command); } else { return $this->dispatcher->dispatchNow($command, $handler); } }
Dispatch a command to its appropriate handler in the current process. @param mixed $command @param mixed $handler @return mixed
dispatchNow
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function dispatchToQueue($command) { if ($this->shouldFakeJob($command)) { $this->commands[get_class($command)][] = $this->getCommandRepresentation($command); } else { return $this->dispatcher->dispatchToQueue($command); } }
Dispatch a command to its appropriate handler behind a queue. @param mixed $command @return mixed
dispatchToQueue
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function batch($jobs) { return new PendingBatchFake($this, Collection::wrap($jobs)); }
Create a new batch of queueable jobs. @param \Illuminate\Support\Collection|array $jobs @return \Illuminate\Bus\PendingBatch
batch
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function dispatchFakeBatch($name = '') { return $this->batch([])->name($name)->dispatch(); }
Dispatch an empty job batch for testing. @param string $name @return \Illuminate\Bus\Batch
dispatchFakeBatch
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function recordPendingBatch(PendingBatch $pendingBatch) { $this->batches[] = $pendingBatch; return $this->batchRepository->store($pendingBatch); }
Record the fake pending batch dispatch. @param \Illuminate\Bus\PendingBatch $pendingBatch @return \Illuminate\Bus\Batch
recordPendingBatch
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function serializeAndRestore(bool $serializeAndRestore = true) { $this->serializeAndRestore = $serializeAndRestore; return $this; }
Specify if commands should be serialized and restored when being batched. @param bool $serializeAndRestore @return $this
serializeAndRestore
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
protected function serializeAndRestoreCommand($command) { return unserialize(serialize($command)); }
Serialize and unserialize the command to simulate the queueing process. @param mixed $command @return mixed
serializeAndRestoreCommand
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
protected function getCommandRepresentation($command) { return $this->serializeAndRestore ? $this->serializeAndRestoreCommand($command) : $command; }
Return the command representation that should be stored. @param mixed $command @return mixed
getCommandRepresentation
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function pipeThrough(array $pipes) { $this->dispatcher->pipeThrough($pipes); return $this; }
Set the pipes commands should be piped through before dispatching. @param array $pipes @return $this
pipeThrough
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function getCommandHandler($command) { return $this->dispatcher->getCommandHandler($command); }
Retrieve the handler for a command. @param mixed $command @return mixed
getCommandHandler
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function dispatchedBatches() { return $this->batches; }
Get the batches that have been dispatched. @return array
dispatchedBatches
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BusFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BusFake.php
MIT
public function __invoke($pendingBatch) { return call_user_func($this->callback, $pendingBatch); }
Invoke the truth test with the given pending batch. @param \Illuminate\Bus\PendingBatch $pendingBatch @return bool
__invoke
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/ChainedBatchTruthTest.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/ChainedBatchTruthTest.php
MIT
protected function serializeAndRestoreNotification($notification) { return unserialize(serialize($notification)); }
Serialize and unserialize the notification to simulate the queueing process. @param mixed $notification @return mixed
serializeAndRestoreNotification
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/NotificationFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/NotificationFake.php
MIT
public function __construct($app, $jobsToFake = [], $queue = null) { parent::__construct($app); $this->jobsToFake = Collection::wrap($jobsToFake); $this->jobsToBeQueued = new Collection; $this->queue = $queue; }
Create a new fake queue instance. @param \Illuminate\Contracts\Foundation\Application $app @param array $jobsToFake @param \Illuminate\Queue\QueueManager|null $queue
__construct
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function except($jobsToBeQueued) { $this->jobsToBeQueued = Collection::wrap($jobsToBeQueued)->merge($this->jobsToBeQueued); return $this; }
Specify the jobs that should be queued instead of faked. @param array|string $jobsToBeQueued @return $this
except
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertPushed($job, $callback = null) { if ($job instanceof Closure) { [$job, $callback] = [$this->firstClosureParameterType($job), $job]; } if (is_numeric($callback)) { return $this->assertPushedTimes($job, $callback); } PHPUnit::assertTrue( $this->pushed($job, $callback)->count() > 0, "The expected [{$job}] job was not pushed." ); }
Assert if a job was pushed based on a truth-test callback. @param string|\Closure $job @param callable|int|null $callback @return void
assertPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
protected function assertPushedTimes($job, $times = 1) { $count = $this->pushed($job)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$job}] job was pushed {$count} times instead of {$times} times." ); }
Assert if a job was pushed a number of times. @param string $job @param int $times @return void
assertPushedTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertPushedWithChain($job, $expectedChain = [], $callback = null) { PHPUnit::assertTrue( $this->pushed($job, $callback)->isNotEmpty(), "The expected [{$job}] job was not pushed." ); PHPUnit::assertTrue( (new Collection($expectedChain))->isNotEmpty(), 'The expected chain can not be empty.' ); $this->isChainOfObjects($expectedChain) ? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback) : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); }
Assert if a job was pushed with chained jobs based on a truth-test callback. @param string $job @param array $expectedChain @param callable|null $callback @return void
assertPushedWithChain
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertPushedWithoutChain($job, $callback = null) { PHPUnit::assertTrue( $this->pushed($job, $callback)->isNotEmpty(), "The expected [{$job}] job was not pushed." ); $this->assertPushedWithChainOfClasses($job, [], $callback); }
Assert if a job was pushed with an empty chain based on a truth-test callback. @param string $job @param callable|null $callback @return void
assertPushedWithoutChain
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertClosurePushed($callback = null) { $this->assertPushed(CallQueuedClosure::class, $callback); }
Assert if a closure was pushed based on a truth-test callback. @param callable|int|null $callback @return void
assertClosurePushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertClosureNotPushed($callback = null) { $this->assertNotPushed(CallQueuedClosure::class, $callback); }
Assert that a closure was not pushed based on a truth-test callback. @param callable|null $callback @return void
assertClosureNotPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
protected function isChainOfObjects($chain) { return ! (new Collection($chain))->contains(fn ($job) => ! is_object($job)); }
Determine if the given chain is entirely composed of objects. @param array $chain @return bool
isChainOfObjects
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertNotPushed($job, $callback = null) { if ($job instanceof Closure) { [$job, $callback] = [$this->firstClosureParameterType($job), $job]; } PHPUnit::assertCount( 0, $this->pushed($job, $callback), "The unexpected [{$job}] job was pushed." ); }
Determine if a job was pushed based on a truth-test callback. @param string|\Closure $job @param callable|null $callback @return void
assertNotPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertCount($expectedCount) { $actualCount = (new Collection($this->jobs))->flatten(1)->count(); PHPUnit::assertSame( $expectedCount, $actualCount, "Expected {$expectedCount} jobs to be pushed, but found {$actualCount} instead." ); }
Assert the total count of jobs that were pushed. @param int $expectedCount @return void
assertCount
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function assertNothingPushed() { $pushedJobs = implode("\n- ", array_keys($this->jobs)); PHPUnit::assertEmpty($this->jobs, "The following jobs were pushed unexpectedly:\n\n- $pushedJobs\n"); }
Assert that no jobs were pushed. @return void
assertNothingPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function listenersPushed($listenerClass, $callback = null) { if (! $this->hasPushed(CallQueuedListener::class)) { return new Collection; } $collection = (new Collection($this->jobs[CallQueuedListener::class])) ->filter(fn ($data) => $data['job']->class === $listenerClass); if ($callback) { $collection = $collection->filter(fn ($data) => $callback($data['job']->data[0] ?? null, $data['job'], $data['queue'], $data['data'])); } return $collection->pluck('job'); }
Get all of the jobs by listener class, passing an optional truth-test callback. @param class-string $listenerClass @param (\Closure(mixed, \Illuminate\Events\CallQueuedListener, string|null, mixed): bool)|null $callback @return \Illuminate\Support\Collection<int, \Illuminate\Events\CallQueuedListener>
listenersPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function hasPushed($job) { return isset($this->jobs[$job]) && ! empty($this->jobs[$job]); }
Determine if there are any stored jobs for a given class. @param string $job @return bool
hasPushed
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function connection($value = null) { return $this; }
Resolve a queue connection instance. @param mixed $value @return \Illuminate\Contracts\Queue\Queue
connection
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function push($job, $data = '', $queue = null) { if ($this->shouldFakeJob($job)) { if ($job instanceof Closure) { $job = CallQueuedClosure::create($job); } $this->jobs[is_object($job) ? get_class($job) : $job][] = [ 'job' => $this->serializeAndRestore ? $this->serializeAndRestoreJob($job) : $job, 'queue' => $queue, 'data' => $data, ]; } else { is_object($job) && isset($job->connection) ? $this->queue->connection($job->connection)->push($job, $data, $queue) : $this->queue->push($job, $data, $queue); } }
Push a new job onto the queue. @param string|object $job @param mixed $data @param string|null $queue @return mixed
push
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function shouldFakeJob($job) { if ($this->shouldDispatchJob($job)) { return false; } if ($this->jobsToFake->isEmpty()) { return true; } return $this->jobsToFake->contains( fn ($jobToFake) => $job instanceof ((string) $jobToFake) || $job === (string) $jobToFake ); }
Determine if a job should be faked or actually dispatched. @param object $job @return bool
shouldFakeJob
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
protected function shouldDispatchJob($job) { if ($this->jobsToBeQueued->isEmpty()) { return false; } return $this->jobsToBeQueued->contains( fn ($jobToQueue) => $job instanceof ((string) $jobToQueue) ); }
Determine if a job should be pushed to the queue instead of faked. @param object $job @return bool
shouldDispatchJob
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function laterOn($queue, $delay, $job, $data = '') { return $this->push($job, $data, $queue); }
Push a new job onto a specific queue after (n) seconds. @param string $queue @param \DateTimeInterface|\DateInterval|int $delay @param string|object $job @param mixed $data @return mixed
laterOn
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function pushedJobs() { return $this->jobs; }
Get the jobs that have been pushed. @return array
pushedJobs
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function rawPushes() { return $this->rawPushes; }
Get the payloads that were pushed raw. @return list<RawPushType>
rawPushes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
protected function serializeAndRestoreJob($job) { return unserialize(serialize($job)); }
Serialize and unserialize the job to simulate the queueing process. @param mixed $job @return mixed
serializeAndRestoreJob
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function getConnectionName() { // }
Get the connection name for the queue. @return string
getConnectionName
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function __call($method, $parameters) { throw new BadMethodCallException(sprintf( 'Call to undefined method %s::%s()', static::class, $method )); }
Override the QueueManager to prevent circular dependency. @param string $method @param array $parameters @return mixed @throws \BadMethodCallException
__call
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/QueueFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/QueueFake.php
MIT
public function __construct(Dispatcher $dispatcher, $eventsToFake = []) { $this->dispatcher = $dispatcher; $this->eventsToFake = Arr::wrap($eventsToFake); }
Create a new event fake instance. @param \Illuminate\Contracts\Events\Dispatcher $dispatcher @param array|string $eventsToFake
__construct
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function except($eventsToDispatch) { $this->eventsToDispatch = array_merge( $this->eventsToDispatch, Arr::wrap($eventsToDispatch) ); return $this; }
Specify the events that should be dispatched instead of faked. @param array|string $eventsToDispatch @return $this
except
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function assertDispatched($event, $callback = null) { if ($event instanceof Closure) { [$event, $callback] = [$this->firstClosureParameterType($event), $event]; } if (is_int($callback)) { return $this->assertDispatchedTimes($event, $callback); } PHPUnit::assertTrue( $this->dispatched($event, $callback)->count() > 0, "The expected [{$event}] event was not dispatched." ); }
Assert if an event was dispatched based on a truth-test callback. @param string|\Closure $event @param callable|int|null $callback @return void
assertDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function assertDispatchedTimes($event, $times = 1) { $count = $this->dispatched($event)->count(); PHPUnit::assertSame( $times, $count, "The expected [{$event}] event was dispatched {$count} times instead of {$times} times." ); }
Assert if an event was dispatched a number of times. @param string $event @param int $times @return void
assertDispatchedTimes
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function assertNotDispatched($event, $callback = null) { if ($event instanceof Closure) { [$event, $callback] = [$this->firstClosureParameterType($event), $event]; } PHPUnit::assertCount( 0, $this->dispatched($event, $callback), "The unexpected [{$event}] event was dispatched." ); }
Determine if an event was dispatched based on a truth-test callback. @param string|\Closure $event @param callable|null $callback @return void
assertNotDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function assertNothingDispatched() { $count = count(Arr::flatten($this->events)); $eventNames = (new Collection($this->events)) ->map(fn ($events, $eventName) => sprintf( '%s dispatched %s %s', $eventName, count($events), Str::plural('time', count($events)), )) ->join("\n- "); PHPUnit::assertSame( 0, $count, "{$count} unexpected events were dispatched:\n\n- $eventNames\n" ); }
Assert that no events were dispatched. @return void
assertNothingDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function hasDispatched($event) { return isset($this->events[$event]) && ! empty($this->events[$event]); }
Determine if the given event has been dispatched. @param string $event @return bool
hasDispatched
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
protected function fakeEvent($event, $name, $arguments) { if ($event instanceof ShouldDispatchAfterCommit && Container::getInstance()->bound('db.transactions')) { return Container::getInstance()->make('db.transactions') ->addCallback(fn () => $this->events[$name][] = $arguments); } $this->events[$name][] = $arguments; }
Push the event onto the fake events array immediately or after the next database transaction. @param string|object $event @param string $name @param array $arguments @return void
fakeEvent
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function until($event, $payload = []) { return $this->dispatch($event, $payload, true); }
Dispatch an event and call the listeners. @param string|object $event @param mixed $payload @return mixed
until
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function dispatchedEvents() { return $this->events; }
Get the events that have been dispatched. @return array
dispatchedEvents
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function __call($method, $parameters) { return $this->forwardCallTo($this->dispatcher, $method, $parameters); }
Handle dynamic method calls to the dispatcher. @param string $method @param array $parameters @return mixed
__call
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/EventFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/EventFake.php
MIT
public function decrementPendingJobs(string $batchId, string $jobId) { return new UpdatedBatchJobCounts; }
Decrement the total number of pending jobs for the batch. @param string $batchId @param string $jobId @return \Illuminate\Bus\UpdatedBatchJobCounts
decrementPendingJobs
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php
MIT
public function incrementFailedJobs(string $batchId, string $jobId) { return new UpdatedBatchJobCounts; }
Increment the total number of failed jobs for the batch. @param string $batchId @param string $jobId @return \Illuminate\Bus\UpdatedBatchJobCounts
incrementFailedJobs
php
laravel/framework
src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php
MIT
public static function fake($jobsToFake = []) { $actualQueueManager = static::isFake() ? static::getFacadeRoot()->queue : static::getFacadeRoot(); return tap(new QueueFake(static::getFacadeApplication(), $jobsToFake, $actualQueueManager), function ($fake) { static::swap($fake); }); }
Replace the bound instance with a fake. @param array|string $jobsToFake @return \Illuminate\Support\Testing\Fakes\QueueFake
fake
php
laravel/framework
src/Illuminate/Support/Facades/Queue.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Facades/Queue.php
MIT
public static function fake($eventsToFake = []) { $actualDispatcher = static::isFake() ? static::getFacadeRoot()->dispatcher : static::getFacadeRoot(); return tap(new EventFake($actualDispatcher, $eventsToFake), function ($fake) { static::swap($fake); Model::setEventDispatcher($fake); Cache::refreshEventDispatcher(); }); }
Replace the bound instance with a fake. @param array|string $eventsToFake @return \Illuminate\Support\Testing\Fakes\EventFake
fake
php
laravel/framework
src/Illuminate/Support/Facades/Event.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Facades/Event.php
MIT
public static function prohibitDestructiveCommands(bool $prohibit = true) { FreshCommand::prohibit($prohibit); RefreshCommand::prohibit($prohibit); ResetCommand::prohibit($prohibit); RollbackCommand::prohibit($prohibit); WipeCommand::prohibit($prohibit); }
Indicate if destructive Artisan commands should be prohibited. Prohibits: db:wipe, migrate:fresh, migrate:refresh, migrate:reset, and migrate:rollback @param bool $prohibit @return void
prohibitDestructiveCommands
php
laravel/framework
src/Illuminate/Support/Facades/DB.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Facades/DB.php
MIT
public static function spy() { if (! static::isMock()) { $class = static::getMockableClass(); return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { static::swap($spy); }); } }
Convert the facade into a Mockery spy. @return \Mockery\MockInterface
spy
php
laravel/framework
src/Illuminate/Support/Facades/Facade.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Facades/Facade.php
MIT