W3cubDocs

/Laravel 5.8

NotificationFake

class NotificationFake implements Factory, Dispatcher (View source)

Traits

Macroable

Properties

static protected array $macros The registered string macros. from Macroable
protected array $notifications All of the notifications that have been sent.
string|null $locale Locale used when sending notifications.

Methods

static void macro(string $name, object|callable $macro)

Register a custom macro.

from Macroable
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

from Macroable
static bool hasMacro(string $name)

Checks if macro is registered.

from Macroable
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

from Macroable
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

from Macroable
void assertSentTo(mixed $notifiable, string $notification, callable|null $callback = null)

Assert if a notification was sent based on a truth-test callback.

void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)

Assert if a notification was sent a number of times.

void assertNotSentTo(mixed $notifiable, string $notification, callable|null $callback = null)

Determine if a notification was sent based on a truth-test callback.

void assertNothingSent()

Assert that no notifications were sent.

void assertTimesSent(int $expectedCount, string $notification)

Assert the total amount of times a notification was sent.

Collection sent(mixed $notifiable, string $notification, callable|null $callback = null)

Get all of the notifications matching a truth-test callback.

bool hasSent(mixed $notifiable, string $notification)

Determine if there are more notifications left to inspect.

array notificationsFor(mixed $notifiable, string $notification)

Get all of the notifications for a notifiable entity by type.

void send(Collection|array|mixed $notifiables, mixed $notification)

Send the given notification to the given notifiable entities.

void sendNow(Collection|array|mixed $notifiables, mixed $notification, array $channels = null)

Send the given notification immediately.

mixed channel(string|null $name = null)

Get a channel instance by name.

$this locale(string $locale)

Set the locale of notifications.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void assertSentTo(mixed $notifiable, string $notification, callable|null $callback = null)

Assert if a notification was sent based on a truth-test callback.

Parameters

mixed $notifiable
string $notification
callable|null $callback

Return Value

void

void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)

Assert if a notification was sent a number of times.

Parameters

mixed $notifiable
string $notification
int $times

Return Value

void

void assertNotSentTo(mixed $notifiable, string $notification, callable|null $callback = null)

Determine if a notification was sent based on a truth-test callback.

Parameters

mixed $notifiable
string $notification
callable|null $callback

Return Value

void

void assertNothingSent()

Assert that no notifications were sent.

Return Value

void

void assertTimesSent(int $expectedCount, string $notification)

Assert the total amount of times a notification was sent.

Parameters

int $expectedCount
string $notification

Return Value

void

Collection sent(mixed $notifiable, string $notification, callable|null $callback = null)

Get all of the notifications matching a truth-test callback.

Parameters

mixed $notifiable
string $notification
callable|null $callback

Return Value

Collection

bool hasSent(mixed $notifiable, string $notification)

Determine if there are more notifications left to inspect.

Parameters

mixed $notifiable
string $notification

Return Value

bool

protected array notificationsFor(mixed $notifiable, string $notification)

Get all of the notifications for a notifiable entity by type.

Parameters

mixed $notifiable
string $notification

Return Value

array

void send(Collection|array|mixed $notifiables, mixed $notification)

Send the given notification to the given notifiable entities.

Parameters

Collection|array|mixed $notifiables
mixed $notification

Return Value

void

void sendNow(Collection|array|mixed $notifiables, mixed $notification, array $channels = null)

Send the given notification immediately.

Parameters

Collection|array|mixed $notifiables
mixed $notification
array $channels

Return Value

void

mixed channel(string|null $name = null)

Get a channel instance by name.

Parameters

string|null $name

Return Value

mixed

$this locale(string $locale)

Set the locale of notifications.

Parameters

string $locale

Return Value

$this

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/Support/Testing/Fakes/NotificationFake.html