-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Mail\Mailables\Address; | ||
use Illuminate\Mail\Mailables\Content; | ||
use Illuminate\Mail\Mailables\Envelope; | ||
use Illuminate\Queue\SerializesModels; | ||
|
@@ -34,7 +35,17 @@ public function __construct(Post $post) | |
public function envelope() | ||
{ | ||
return new Envelope( | ||
from: new Address('[email protected]', 'Medium Online Publication'), | ||
to: new Address('[email protected]', 'Abu Jobaer'), | ||
bcc: new Address('[email protected]', 'Ria Jobaer'), | ||
replyTo: [ | ||
new Address('[email protected]', 'Taylor Otwell'), | ||
], | ||
subject: 'Post Published', | ||
tags: ['architecture', 'design-patterns'], | ||
metadata: [ | ||
'post_id' => $this->post->id, | ||
], | ||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,34 @@ public function mailable_can_be_previewed() | |
$this->get(route('mailable.preview', $post->id)) | ||
->assertStatus(200); | ||
} | ||
|
||
/** @test */ | ||
public function mailable_has_valid_content() | ||
{ | ||
$this->actingAs($user = User::factory()->create()); | ||
|
||
$post = Post::factory()->create(['user_id' => $user->id]); | ||
|
||
$mailable = new PostPublished($post); | ||
|
||
$mailable->assertFrom('[email protected]'); | ||
|
||
$mailable->assertTo('[email protected]'); | ||
|
||
$mailable->assertHasBcc('[email protected]'); | ||
|
||
$mailable->assertHasReplyTo('[email protected]'); | ||
|
||
$mailable->assertHasSubject('Post Published'); | ||
|
||
$mailable->assertHasTag('design-patterns'); | ||
|
||
$mailable->assertHasMetadata('post_id', $post->id); | ||
|
||
$mailable->assertSeeInHtml('Post Published'); | ||
|
||
$mailable->assertSeeInOrderInHtml(['View Post', 'Thanks']); | ||
|
||
$mailable->assertSeeInOrderInText(['View Post', 'Thanks']); | ||
} | ||
} |