mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
155 - Test-Driving the Email Contents
This commit is contained in:
@@ -30,6 +30,7 @@ class InvitationEmail extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('view.name');
|
||||
return $this->view('emails.invitation-email')
|
||||
->subject("You're invited to join TicketBeast!");
|
||||
}
|
||||
}
|
||||
|
||||
6
resources/views/emails/invitation-email.blade.php
Normal file
6
resources/views/emails/invitation-email.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<p>You're invited to promote your concerts on TicketBeast!</p>
|
||||
|
||||
<p>
|
||||
Visit this link to create your account:
|
||||
<a href="{{ url("/invitations/{$invitation->code}") }}">{{ url("/invitations/{$invitation->code}") }}</a>
|
||||
</p>
|
||||
34
tests/Unit/Mail/InvitationEmailTest.php
Normal file
34
tests/Unit/Mail/InvitationEmailTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Mail;
|
||||
|
||||
use App\Invitation;
|
||||
use Tests\TestCase;
|
||||
use App\Mail\InvitationEmail;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class InvitationEmailTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
function email_contains_a_link_to_accept_the_invitation()
|
||||
{
|
||||
$invitation = factory(Invitation::class)->make([
|
||||
'email' => 'john@example.com',
|
||||
'code' => 'TESTCODE1234',
|
||||
]);
|
||||
|
||||
$email = new InvitationEmail($invitation);
|
||||
|
||||
$this->assertContains(url('/invitations/TESTCODE1234'), $email->render());
|
||||
}
|
||||
/** @test */
|
||||
function email_has_the_correct_subject()
|
||||
{
|
||||
$invitation = factory(Invitation::class)->make();
|
||||
|
||||
$email = new InvitationEmail($invitation);
|
||||
|
||||
$this->assertEquals("You're invited to join TicketBeast!", $email->build()->subject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user