just-pthai-it's avatar

Do mails actually send when running Laravel test?

I have a feature test which send mails at last. I commented the mail fake code section in order to know that mails were actually sent. The send mail method was called. But when I check my mailbox, there are not any mails were sent to me. Is it normal that Laravel will not actually send mail in test (I do not see any reference about it in the docs).

P/s: I added an dump code into the constructor of Mailable class and it did show on the terminal. But no mails were sent

0 likes
2 replies
just-pthai-it's avatar

@martinbean Thanks, just want to check I can send mail in test. It seems like the env variables in phpunit.xml file override the .env file. I create .env.testing file to running test with MAIL_MAILER=smtp but it won't work, When I change value of MAIL_MAILER=smtp in phpunit.xml file, it did send mails.

Please or to participate in this conversation.