Pages

Monday, July 9, 2012

Writing a PHPUnit test for Symfony2 to test email sending

The idea is to test that an email is sent by a contact form by inspecting the SwiftMailler Collector.

We generate a fake unique content and loop through all sent emails to verify that is was sent.

Note that this does not actually test if the email is sent to the server but merely tells you if Symfony is trying to send it.


Inspiration: http://docs.behat.org/cookbook/using_the_profiler_with_minkbundle.html

No comments:

Post a Comment