diff --git a/email/testing.rst b/email/testing.rst index 45b45350d77..66df5f33f8b 100644 --- a/email/testing.rst +++ b/email/testing.rst @@ -26,10 +26,6 @@ Start with an easy controller action that sends an email:: return $this->render(...); } -.. note:: - - Don't forget to enable the profiler as explained in :doc:`/testing/profiling`. - In your functional test, use the ``swiftmailer`` collector on the profiler to get information about the messages sent on the previous request:: @@ -67,4 +63,22 @@ to get information about the messages sent on the previous request:: } } +Troubleshooting +--------------- + +Problem: The collector object is ``null`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The email collector is only available when the profiler is enabled and collects +information, as explained in :doc:`/testing/profiling`. + +Problem: The collector doesn't contain the email +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If a redirection is performed after sending the email (for example when you send +an email after a form is processed and before redirecting to another page), make +sure that the test client doesn't follow the redirects, as explained in +:doc:`/testing`. Otherwise, the collector will contain the information of the +redirected page and the email won't be accessible. + .. _`Swift Mailer`: http://swiftmailer.org/