Sebastian Göttschkes has a new post showing a method he's come up with to test email sending in a Symfony2 application.
On my endless struggle to achieving 100% code coverage and catching every possible (and impossible) test case (I'm just kiddinh, please don't do this!) I was in need for some way to test the sending of emails. This blog post will show you how to test this within a symfony2 (I'm using symfony 2.1 RC2) application, using the default swiftmailer.
It's not unit testing, it's functional testing, and he provides a bit of background on the process first then sets up a dummy listener for testing and how to plug in the Symfony2 functionality (via a getContainer call to get the DIC).
没有评论:
发表评论