mercredi 6 novembre 2019

How to write test case for checking mail body in Laravel

I have a controller where certain tasks are done along with a feature of sending mail to users. So wanted to write test cases for that as we were following TDD approach and we decided not to use mock for this purpose. Instead we used Mail::fake(). In my controller, I am queueing mail and using a mailable class to render my view and passing data to that mailable class. As a result, I cant check(in my test cases) the mail body or subject of that mailable class. Any idea on how to write test cases for checking mail body or any other best practices for that?

Aucun commentaire:

Enregistrer un commentaire