Open janhenkgerritsen opened 8 years ago
We have seeEmailIsSent
in Symfony2 module but it doesn't perform any checks on type of email messages. Just verifies that something was sent...
I could just provide assertions for the last email that was sent, things like seeEmailIsSent
, seeEmailIsSentTo
, seeEmailIsSentFrom
, seeEmailIsSentWithSubject
, etc. But what if multiple emails were sent?
One option is to just loop through all emails that were sent and check if one of those satisfies the assertion.
Another option is to just add a method grabEmails
and let users handle those cases themselves.
In the Laracast video Jeffrey adds a second optional parameter for the message object to the assertion methods, but if we do that the assertions should probably have other names.
Any preferences or other ideas?
My preferable syntax will be:
seeEmailIsSent(array $params = null, $num = 1);
so to be used as:
$I->seeEmailIsSent();
$I->seeEmailIsSent(['from' => 'admin@site.com'], 2);
$I->seeEmailIsSent(['subject' => 'XXX', 'from' => 'yyyy']);
Ok, that look's good to me too. I don't know when I have time to implement it yet though.
I don't know when I have time to implement it yet though.
Yep, that's always an issue. Maybe someone who accidentally finds oneself here will have a chance to implement it =)
Accidentally found myself here and I am considering implementing this. Is there any documentation on the inner workings of Codeception's email support?
@janhenkgerritsen I can help out if you're still interested in implementing this.
There is no such thing as "Codeception email support", this functionality is module specific.
It would be great if you implement this, because I don't really have the time to do this myself. So if you come up with a nice solution it will definitely get merged :)
@janhenkgerritsen Sounds good! I will start working on it now.
@janhenkgerritsen, @grahamsutton - any progress on implementing email assertions? If not, then I'll be happy to try to push something this weekend.
Add email assertions to Laravel 5 module.
Idea for implementation came from https://laracasts.com/series/phpunit-testing-in-laravel/episodes/12. Will work with all default mail transports in Laravel, they all have the
beforeSendPerformed
method.Have to think about a good API for these assertions though.