Level 50
This might help for 5.3 : https://gist.github.com/sileence/85298aa1a5f6a24026caba72fbdf5c88
1 like
how can I test if mail body contains a link for example? I use laravel 5.3
public function we_can_send_email_verification_email_to_existing_player()
{
Mail::fake();
// Given if I have an admin User
$admin = factory(User::class)->create();
// And a Player
$player = factory(Player::class)->create();
// When Admin is logged in and visits the Player's profile page
$this->actingAs($admin)
->visitRoute('players.show', ['player' => $player->f_id])
->see($player->f_name)
->see('Resend email verification request');
// If he clicks on Resend email verification request we should see proper response
$this->json('POST', "players/".$player->f_id."/send-email-verification", [])
->seeJsonEquals(['success' => true]);
Mail::assertSent(EmailValidationEmail::class, function ($mail) use ($player) {
return $mail->player->f_id === $player->f_id;
});
// Assert a message was sent to the given users...
Mail::assertSentTo([$player->f_mail], EmailValidationEmail::class);
}
This might help for 5.3 : https://gist.github.com/sileence/85298aa1a5f6a24026caba72fbdf5c88
Please or to participate in this conversation.