Skip to content

Commit

Permalink
add assert see for maliables & sender
Browse files Browse the repository at this point in the history
  • Loading branch information
jcergolj committed Jan 5, 2021
1 parent 78385bd commit feba55d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
11 changes: 8 additions & 3 deletions tests/Unit/Mail/InvitationMailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public function email_contains_link()
['user' => $user->id]
);

$rendered = $mail->render();

$this->assertStringContainsString(htmlspecialchars($signedUrl), $rendered);
$mail->assertSeeInHtml(htmlspecialchars($signedUrl));
}

/** @test */
Expand All @@ -38,4 +36,11 @@ public function email_has_a_subject()
$mail = new InvitationMail(create_user(), Carbon::tomorrow());
$this->assertNotNull($mail->build()->subject);
}

/** @test */
public function email_has_a_sender()
{
$mail = new InvitationMail(create_user(), Carbon::tomorrow());
$this->assertTrue($mail->build()->hasFrom('no-replay@laravellte.com', 'laravellte'));
}
}
13 changes: 9 additions & 4 deletions tests/Unit/Mail/NewEmailConfirmationMailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public function email_contains_link()
['user' => $user->id, 'new_email' => 'joe@example.com']
);

$rendered = $mail->render();

$this->assertStringContainsString(htmlspecialchars($signedUrl), $rendered);
$this->assertStringContainsString('joe@example.com', $rendered);
$mail->assertSeeInHtml(htmlspecialchars($signedUrl));
$mail->assertSeeInText('joe@example.com');
}

/** @test */
Expand All @@ -39,4 +37,11 @@ public function email_has_a_subject()
$mail = new NewEmailConfirmationMail(create_user(), Carbon::tomorrow(), 'joe@example.com');
$this->assertNotNull($mail->build()->subject);
}

/** @test */
public function email_has_a_sender()
{
$mail = new NewEmailConfirmationMail(create_user(), Carbon::tomorrow(), 'joe@example.com');
$this->assertTrue($mail->build()->hasFrom('no-replay@laravellte.com', 'laravellte'));
}
}
15 changes: 10 additions & 5 deletions tests/Unit/Mail/PasswordChangedMailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ class PasswordChangedMailTest extends TestCase
public function email_contains_password_changed_text()
{
$mail = new PasswordChangedMail();

$rendered = $mail->render();

$this->assertStringContainsString('your password has been changed', $rendered);
$mail->assertSeeInText('your password has been changed');
}

/** @test */
public function email_has_a_subject()
{
$this->assertEquals('Security notification regarding your password', (new PasswordChangedMail())->build()->subject);
$mail = new PasswordChangedMail();
$this->assertEquals('Security notification regarding your password', $mail->build()->subject);
}

/** @test */
public function email_has_a_sender()
{
$mail = new PasswordChangedMail();
$this->assertTrue($mail->build()->hasFrom('no-replay@laravellte.com', 'laravellte'));
}
}

0 comments on commit feba55d

Please sign in to comment.