Skip to content

Instantly share code, notes, and snippets.

@bedus-creation
Created June 12, 2019 10:30
Show Gist options
  • Save bedus-creation/fcb61a55590fe75cf47b1829a93ea7f2 to your computer and use it in GitHub Desktop.
Save bedus-creation/fcb61a55590fe75cf47b1829a93ea7f2 to your computer and use it in GitHub Desktop.
Test email queued in laravel application. This particular gist test the email is queued to jobseeker and company user when jobseeker applied to the jobs.
public function email_is_sent_when_job_applied()
{
Mail::fake();
$this->be(cUser('jobseeker'));
$data = $this->getData();
$this->post('job/applyjobs', $data);
$company = User::find($data["company_id"]);
Mail::assertQueued(JobAppliedEmail::class, 2);
Mail::assertQueued(JobAppliedEmail::class, function ($email) {
return $email->to(auth()->user()->email);
});
Mail::assertQueued(JobAppliedEmail::class, function ($email) use ($company) {
return $email->to($company->email);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment