|
1 | 1 | .. index::
|
2 | 2 | single: Emails; Testing
|
3 | 3 |
|
4 |
| -How to Test that an Email is Sent in a functional Test |
| 4 | +How to Test that an Email is Sent in a Functional Test |
5 | 5 | ======================================================
|
6 | 6 |
|
7 |
| -Sending e-mails with Symfony is pretty straightforward thanks to the |
| 7 | +Sending emails with Symfony is pretty straightforward thanks to the |
8 | 8 | SwiftmailerBundle, which leverages the power of the `Swift Mailer`_ library.
|
9 | 9 |
|
10 | 10 | To functionally test that an email was sent, and even assert the email subject,
|
11 | 11 | content or any other headers, you can use :ref:`the Symfony Profiler <internals-profiler>`.
|
12 | 12 |
|
13 |
| -Start with an easy controller action that sends an e-mail:: |
| 13 | +Start with an easy controller action that sends an email:: |
14 | 14 |
|
15 | 15 | public function sendEmailAction($name)
|
16 | 16 | {
|
@@ -49,13 +49,13 @@ to get information about the messages send on the previous request::
|
49 | 49 |
|
50 | 50 | $mailCollector = $client->getProfile()->getCollector('swiftmailer');
|
51 | 51 |
|
52 |
| - // Check that an e-mail was sent |
| 52 | + // Check that an email was sent |
53 | 53 | $this->assertEquals(1, $mailCollector->getMessageCount());
|
54 | 54 |
|
55 | 55 | $collectedMessages = $mailCollector->getMessages();
|
56 | 56 | $message = $collectedMessages[0];
|
57 | 57 |
|
58 |
| - // Asserting e-mail data |
| 58 | + // Asserting email data |
59 | 59 | $this->assertInstanceOf('Swift_Message', $message);
|
60 | 60 | $this->assertEquals('Hello Email', $message->getSubject());
|
61 | 61 | $this->assertEquals('[email protected]', key($message->getFrom()));
|
|
0 commit comments