How to test email in functional test (Symfony2)
问题 I'm trying to test email in functional test... My source code is the same as the example of the cookbook, the controller : public function sendEmailAction($name) { $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody('You should see me from the profiler!') ; $this->get('mailer')->send($message); return $this->render(...); } And the test : // src/Acme/DemoBundle/Tests/Controller/MailControllerTest.php use