MailFake
class MailFake implements Factory, Fake, Mailer, MailQueue
Traits
Properties
| protected string|null | $currentMailer | The mailer currently being used to send a message. |
|
| protected array | $mailables | All of the mailables that have been sent. |
|
| protected array | $queuedMailables | All of the mailables that have been queued. |
Methods
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
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 mailable was sent based on a truth-test callback.
Assert if a mailable was sent a number of times.
Determine if a mailable was not sent or queued to be sent based on a truth-test callback.
Determine if a mailable was not sent based on a truth-test callback.
Assert that no mailables were sent or queued to be sent.
Assert that no mailables were sent.
Assert if a mailable was queued based on a truth-test callback.
Assert if a mailable was queued a number of times.
Determine if a mailable was not queued based on a truth-test callback.
Assert that no mailables were queued.
Assert the total number of mailables that were sent.
Assert the total number of mailables that were queued.
Assert the total number of mailables that were sent or queued.
Determine if the given mailable has been sent.
Determine if the given mailable has been queued.
Get all of the mailed mailables for a given type.
Get all of the mailed mailables for a given type.
Begin the process of mailing a mailable class instance.
Begin the process of mailing a mailable class instance.
Begin the process of mailing a mailable class instance.
Send a new message with only a raw text part.
Queue a new e-mail message for sending after (n) seconds.
Infer mailable class using reflection if a typehinted closure is passed to assertion.
Forget all of the resolved mailer instances.
Handle dynamic method calls to the mailer.
Details
in
ForwardsCalls at line 22
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
in
ForwardsCalls at line 52
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
in
ForwardsCalls at line 66
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
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 51
__construct(MailManager $manager)
Create a new mail fake.
at line 60
void
assertSent(Closure|string $mailable, array|callable|int|string|null $callback = null)
Assert if a mailable was sent based on a truth-test callback.
at line 93
void
assertSentTimes(string $mailable, int $times = 1)
Assert if a mailable was sent a number of times.
at line 111
void
assertNotOutgoing(Closure|string $mailable, callable|null $callback = null)
Determine if a mailable was not sent or queued to be sent based on a truth-test callback.
at line 120
void
assertNotSent(Closure|string $mailable, array|callable|string|null $callback = null)
Determine if a mailable was not sent based on a truth-test callback.
at line 148
void
assertNothingOutgoing()
Assert that no mailables were sent or queued to be sent.
at line 157
void
assertNothingSent()
Assert that no mailables were sent.
at line 169
void
assertQueued(Closure|string $mailable, array|callable|int|string|null $callback = null)
Assert if a mailable was queued based on a truth-test callback.
at line 200
void
assertQueuedTimes(string $mailable, int $times = 1)
Assert if a mailable was queued a number of times.
at line 218
void
assertNotQueued(Closure|string $mailable, array|callable|string|null $callback = null)
Determine if a mailable was not queued based on a truth-test callback.
at line 246
void
assertNothingQueued()
Assert that no mailables were queued.
at line 258
void
assertSentCount(int $count)
Assert the total number of mailables that were sent.
at line 272
void
assertQueuedCount(int $count)
Assert the total number of mailables that were queued.
at line 286
void
assertOutgoingCount(int $count)
Assert the total number of mailables that were sent or queued.
at line 302
Collection
sent(Closure|string $mailable, callable|null $callback = null)
Get all of the mailables matching a truth-test callback.
at line 318
bool
hasSent(string $mailable)
Determine if the given mailable has been sent.
at line 326
Collection
queued(Closure|string $mailable, callable|null $callback = null)
Get all of the queued mailables matching a truth-test callback.
at line 342
bool
hasQueued(string $mailable)
Determine if the given mailable has been queued.
at line 350
protected Collection
mailablesOf(string $type)
Get all of the mailed mailables for a given type.
at line 358
protected Collection
queuedMailablesOf(string $type)
Get all of the mailed mailables for a given type.
at line 366
Mailer
mailer(UnitEnum|string|null $name = null)
Get a mailer instance by name.
at line 380
Mailer
driver(UnitEnum|string|null $driver = null)
Get a mailer driver instance.
at line 388
PendingMail
to(mixed $users)
Begin the process of mailing a mailable class instance.
at line 396
PendingMail
cc(mixed $users)
Begin the process of mailing a mailable class instance.
at line 404
PendingMail
bcc(mixed $users)
Begin the process of mailing a mailable class instance.
at line 412
SentMessage|null
raw(string $text, mixed $callback)
Send a new message with only a raw text part.
at line 420
SentMessage|null
send(array|Mailable|string $view, array $data = [], Closure|string|null $callback = null)
Send a new message using a view.
at line 430
SentMessage|null
sendNow(array|Mailable|string $mailable, array $data = [], Closure|string|null $callback = null)
Send a new message synchronously using a view.
at line 440
protected mixed
sendMail(array|Mailable|string $view, bool $shouldQueue = false)
Send a new message using a view.
at line 462
mixed
queue(array|Mailable|string $view, string|null $queue = null)
Queue a new message for sending.
at line 480
mixed
later(DateInterval|DateTimeInterface|int $delay, array|Mailable|string $view, string|null $queue = null)
Queue a new e-mail message for sending after (n) seconds.
at line 488
protected array
prepareMailableAndCallback(Closure|string $mailable, callable|string|null $callback)
Infer mailable class using reflection if a typehinted closure is passed to assertion.
at line 500
MailFake
forgetMailers()
Forget all of the resolved mailer instances.
at line 510
__call(string $method, array $parameters)
Handle dynamic method calls to the mailer.