title: Laravel Notification Mailable not working in Test
body: <p>I'am using a notification to send a mail to all users when the notification gets Triggered.</p>
  
  <p>This works fine in manual "browsing the website" usage (submit a POST to the ContactController) but in my tests the mail facade claims that no mail gets sent.</p>
  
  <p>Controller:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Notifications\ContactRequestNotification;
  use App\User;
  use Illuminate\Http\Request;
  use Notification;
  
  class ContactController extends Controller
  {
      public function create(Request $request)
      {
          $validateData = $request-&gt;validate([
              'name' =&gt; 'required',
              'email' =&gt; 'required|email',
              'message' =&gt; 'required'
          ]);
  
          Notification::send(User::all(), new ContactRequestNotification($validateData));
  
          return $validateData;
      }
  }
  
  </code></pre>
  
  <p>Notification:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Notifications;
  
  use App\Mail\ContactMail;
  use Illuminate\Mail\Mailable;
  use Illuminate\Notifications\Notification;
  
  class ContactRequestNotification extends Notification
  {
      /**
       * @var array
       */
      private $contactData;
  
      /**
       * Create a new notification instance.
       *
       * @return void
       */
      public function __construct($contactData)
      {
          $this-&gt;contactData = $contactData;
      }
  
      /**
       * Get the notification's delivery channels.
       *
       * @param mixed $notifiable
       * @return array
       */
      public function via($notifiable)
      {
          return ['mail'];
      }
  
      /**
       * Get the mail representation of the notification.
       *
       * @param mixed $notifiable
       * @return Mailable
       */
      public function toMail($notifiable)
      {
          return (new ContactMail($this-&gt;contactData['name'], $this-&gt;contactData['email'], $this-&gt;contactData['message']))-&gt;to($notifiable-&gt;email);
      }
  
      /**
       * Get the array representation of the notification.
       *
       * @param mixed $notifiable
       * @return array
       */
      public function toArray($notifiable)
      {
          return $this-&gt;contactData;
      }
  }
  
  </code></pre>
  
  <p>Mailable:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Mail;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Mail\Mailable;
  use Illuminate\Queue\SerializesModels;
  
  class ContactMail extends Mailable
  {
      use Queueable, SerializesModels;
  
      /** @var string */
      public $name;
  
      /** @var string */
      public $email;
  
      /** @var string */
      public $message;
  
      /**
       * Create a new message instance.
       *
       * @return void
       */
      public function __construct($name, $email, $message)
      {
          $this-&gt;name = $name;
          $this-&gt;email = $email;
          $this-&gt;message = $message;
      }
  
      /**
       * Build the message.
       *
       * @return $this
       */
      public function build()
      {
          return $this-&gt;markdown('emails.contact')
              -&gt;from(env('MAIL_FROM'))
              -&gt;subject('New contact request');
      }
  }
  
  </code></pre>
  
  <p>Test:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace Tests\Feature;
  
  use App\Mail\ContactMail;
  use App\Notifications\ContactRequestNotification;
  use App\User;
  use Illuminate\Foundation\Testing\DatabaseMigrations;
  use Illuminate\Support\Facades\Mail;
  use Notification;
  use Tests\TestCase;
  
  class ContactFormTest extends TestCase
  {
      use DatabaseMigrations;
  
      /** @test */
      public function a_notification_gets_created_when_the_contact_form_is_used()
      {
          Notification::fake();
  
          $user = factory(User::class)-&gt;create();
  
          $response = $this-&gt;post('/contact', [
              'name' =&gt; 'John Doe',
              'email' =&gt; 'email@email.com',
              'message' =&gt; 'This is a test message'
          ]);
  
          $response-&gt;assertStatus(200);
  
          Notification::assertSentTo($user, ContactRequestNotification::class);
      }
  
      /** @test */
      public function a_mail_is_send_when_the_contact_form_is_used()
      {
          $this-&gt;withExceptionHandling();
  
          factory(User::class)-&gt;create();
  
          Mail::fake();
  
          Mail::assertNothingSent();
  
          $data = [
              'name' =&gt; 'John Doe',
              'email' =&gt; 'email@email.com',
              'message' =&gt; 'This is a test message'
          ];
  
          $response = $this-&gt;post('/contact', $data);
  
          $response-&gt;assertStatus(200);
  
          Mail::assertSent(ContactMail::class, 1);
      }
  }
  
  </code></pre>
  
  <p>The "a_notification_gets_created_when_the_contact_form_is_used" test runs without any problems but the second test case results in: </p>
  
  <pre><code>/usr/bin/php /home/vendor/phpunit/phpunit/phpunit --configuration /home/phpunit.xml --filter "/(::a_mail_is_send_when_the_contact_form_is_used)( .*)?$/" Tests\Feature\ContactFormTest /home/tests/Feature/ContactFormTest.php --teamcity
  PHPUnit 8.3.4 by Sebastian Bergmann and contributors.
  
  
  The expected [App\Mail\ContactMail] mailable was sent 0 times instead of 1 times.
  Failed asserting that false is true.
  
  </code></pre>
  
  <p>When performing the same tasks in the browser a mail gets sent to the user.</p>
  
  <p>Any tips on what i am missing here? An internet search revealed that some other people had this problem but neither found a solution (or that I am not capable of performing the correct search)</p>
  
  <p>Thanks!</p>