NotificationFake
class NotificationFake implements Dispatcher, Factory (View source)
Traits
Macroable | |
ReflectsClosures |
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 void | flushMacros()
Flush the existing macros. | 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 |
string | firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure. | from ReflectsClosures |
array | firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types. | from ReflectsClosures |
array | closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure. | from ReflectsClosures |
void | assertSentOnDemand(string|Closure $notification, callable|null $callback = null)
Assert if a notification was sent on-demand based on a truth-test callback. | |
void | assertSentTo(mixed $notifiable, string|Closure $notification, callable|null $callback = null)
Assert if a notification was sent based on a truth-test callback. | |
void | assertSentOnDemandTimes(string $notification, int $times = 1)
Assert if a notification was sent on-demand a number of times. | |
void | assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
Assert if a notification was sent a number of times. | |
void | assertNotSentTo(mixed $notifiable, string|Closure $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 | assertNothingSentTo(mixed $notifiable)
Assert that no notifications were sent to the given notifiable. | |
void | assertSentTimes(string $notification, int $expectedCount)
Assert the total amount of times a notification was sent. | |
void | assertCount(int $expectedCount)
Assert the total count of notification that were sent. | |
void | assertTimesSent(int $expectedCount, string $notification) deprecated
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. | |
array | sentNotifications()
Get the notifications that have been sent. |
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 void flushMacros()
Flush the existing macros.
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.
protected string firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
protected array firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
protected array closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
void assertSentOnDemand(string|Closure $notification, callable|null $callback = null)
Assert if a notification was sent on-demand based on a truth-test callback.
void assertSentTo(mixed $notifiable, string|Closure $notification, callable|null $callback = null)
Assert if a notification was sent based on a truth-test callback.
void assertSentOnDemandTimes(string $notification, int $times = 1)
Assert if a notification was sent on-demand a number of times.
void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
Assert if a notification was sent a number of times.
void assertNotSentTo(mixed $notifiable, string|Closure $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 assertNothingSentTo(mixed $notifiable)
Assert that no notifications were sent to the given notifiable.
void assertSentTimes(string $notification, int $expectedCount)
Assert the total amount of times a notification was sent.
void assertCount(int $expectedCount)
Assert the total count of notification that were sent.
void assertTimesSent(int $expectedCount, string $notification) deprecated
deprecated
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.
array sentNotifications()
Get the notifications that have been sent.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/9.x/Illuminate/Support/Testing/Fakes/NotificationFake.html