NotificationFake
class NotificationFake implements Fake, Dispatcher, Factory
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. |
|
| protected bool | $serializeAndRestore | Indicates if notifications should be serialized and restored when pushed to the queue. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Get the class name of the first parameter of the given Closure.
Get the class names of the first parameter of the given Closure, including union types.
Get the class names / types of the parameters of the given Closure.
Get the class names / types of the return type of the given Closure.
Assert if a notification was sent on-demand based on a truth-test callback.
Assert if a notification was sent based on a truth-test callback.
Assert if a notification was sent on-demand a number of times.
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 that no notifications were sent to the given notifiable.
Assert the total amount of times a notification was sent.
Assert the total count of notification that were 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.
Specify if notification should be serialized and restored when being "pushed" to the queue.
Serialize and unserialize the notification to simulate the queueing process.
Get the notifications that have been sent.
Flush all static state.
Details
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
ReflectsClosures at line 25
protected string
firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
in
ReflectsClosures at line 48
protected array
firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
in
ReflectsClosures at line 74
protected array
closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
in
ReflectsClosures at line 94
protected array
closureReturnTypes(Closure $closure)
Get the class names / types of the return type of the given Closure.
at line 46
void
assertSentOnDemand(Closure|string $notification, callable|null $callback = null)
Assert if a notification was sent on-demand based on a truth-test callback.
at line 56
void
assertSentTo(mixed $notifiable, Closure|string $notification, callable|int|string|null $callback = null)
Assert if a notification was sent based on a truth-test callback.
at line 88
void
assertSentOnDemandTimes(string $notification, int $times = 1)
Assert if a notification was sent on-demand a number of times.
at line 96
void
assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
Assert if a notification was sent a number of times.
at line 112
void
assertNotSentTo(mixed $notifiable, Closure|string $notification, callable|null $callback = null)
Determine if a notification was sent based on a truth-test callback.
at line 140
void
assertNothingSent()
Assert that no notifications were sent.
at line 157
void
assertNothingSentTo(mixed $notifiable)
Assert that no notifications were sent to the given notifiable.
at line 180
void
assertSentTimes(string $notification, int $expectedCount)
Assert the total amount of times a notification was sent.
at line 200
void
assertCount(int $expectedCount)
Assert the total count of notification that were sent.
at line 214
Collection
sent(mixed $notifiable, string $notification, callable|null $callback = null)
Get all of the notifications matching a truth-test callback.
at line 232
bool
hasSent(mixed $notifiable, string $notification)
Determine if there are more notifications left to inspect.
at line 240
protected array
notificationsFor(mixed $notifiable, string $notification)
Get all of the notifications for a notifiable entity by type.
at line 248
void
send(mixed $notifiables, mixed $notification)
Send the given notification to the given notifiable entities.
at line 256
void
sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)
Send the given notification immediately.
at line 298
mixed
channel(UnitEnum|string|null $name = null)
Get a channel instance by name.
at line 306
NotificationFake
locale(string $locale)
Set the locale of notifications.
at line 316
NotificationFake
serializeAndRestore(bool $serializeAndRestore = true)
Specify if notification should be serialized and restored when being "pushed" to the queue.
at line 326
protected mixed
serializeAndRestoreNotification(mixed $notification)
Serialize and unserialize the notification to simulate the queueing process.
at line 334
array
sentNotifications()
Get the notifications that have been sent.
at line 342
static void
flushState()
Flush all static state.