ton / email-bundle
Symfony2测试环境的邮件包
v1.0.0
2014-09-13 01:43 UTC
Requires
- php: >=5.3.3
- symfony/framework-bundle: ~2.2
- symfony/swiftmailer-bundle: ~2.2
- zendframework/zend-mail: ~2.1
This package is auto-updated.
Last update: 2024-09-13 20:38:58 UTC
README
Symfony2测试环境的邮件包。允许将邮件存储为*.eml文件并在之后读取它们。
配置
config_test.yml
swiftmailer: transport: file
并且对于SwiftmailerBundle V2.2.?使用'swiftmailer.transport.file'而不是'file'。
内存传输
PhpUnitTest.php
use Ton\EmailBundle\EventListener\EmailListener; /** * @todo check multiple initialization */ protected function registerEmailListener() { $container = $this->getContainer(); $mailer = $container->get('mailer'); $plugin = new EmailListener(); $mailer->registerPlugin($plugin); return $plugin; } /** * @test */ public function sendEmail() { $email = $this->registerEmailListener(); $email->clean(); // Send Email $this->assertCount(1, $email->getPreSendMessages()); $email->getPreSendMessage(0); }