NotificationFake
class NotificationFake implements Dispatcher, Factory (View source)
Traits
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
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Assert if a notification was sent based on a truth-test callback.
Assert if a notification was sent a number of times.
Determine if a notification was sent based on a truth-test callback.
Assert that no notifications were sent.
Assert the total amount of times a notification was sent.
Get all of the notifications matching a truth-test callback.
Determine if there are more notifications left to inspect.
Get all of the notifications for a notifiable entity by type.
Send the given notification to the given notifiable entities.
Send the given notification immediately.
Get a channel instance by name.
Set the locale of notifications.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
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.
protected 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.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.