PendingMailFake.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Illuminate\Support\Testing\Fakes;
  3. use Illuminate\Mail\Mailable;
  4. use Illuminate\Mail\PendingMail;
  5. class PendingMailFake extends PendingMail
  6. {
  7. /**
  8. * Create a new instance.
  9. *
  10. * @param \Illuminate\Support\Testing\Fakes\MailFake $mailer
  11. * @return void
  12. */
  13. public function __construct($mailer)
  14. {
  15. $this->mailer = $mailer;
  16. }
  17. /**
  18. * Send a new mailable message instance.
  19. *
  20. * @param \Illuminate\Mail\Mailable $mailable
  21. * @return mixed
  22. */
  23. public function send(Mailable $mailable)
  24. {
  25. return $this->sendNow($mailable);
  26. }
  27. /**
  28. * Send a mailable message immediately.
  29. *
  30. * @param \Illuminate\Mail\Mailable $mailable
  31. * @return mixed
  32. */
  33. public function sendNow(Mailable $mailable)
  34. {
  35. $this->mailer->send($this->fill($mailable));
  36. }
  37. /**
  38. * Push the given mailable onto the queue.
  39. *
  40. * @param \Illuminate\Mail\Mailable $mailable
  41. * @return mixed
  42. */
  43. public function queue(Mailable $mailable)
  44. {
  45. return $this->mailer->queue($this->fill($mailable));
  46. }
  47. }