fakerFactory = \Faker\Factory::create(); $this->appName = 'MailTest'; } /** * Setup the application. */ public function setUp() { parent::setUp(); $this->app->make(SettingsRepository::class)->set('app_name', $this->appName); $this->app->config->set('setting.app_name', $this->appName); } public function createSubscriber() { dispatch(new SubscribeSubscriberCommand( $this->fakerFactory->safeEmail, true )); } /** * Send a notification to subscribers when a new incident * is added. */ public function testNotificationSentForNewIncident() { Mail::fake(); $this->signIn(); $this->createSubscriber(); $response = $this->post('dashboard/incidents/create', [ 'name' => $this->fakerFactory->word, 'status' => 1, 'visible' => 1, 'message' => $this->fakerFactory->paragraph, 'notify' => 1 ]); Mail::assertSent(NewIncidentNotification::class); } }