ton / email-bundle
Email bundle for test environment of Symfony2
Installs: 339
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 5
Open Issues: 0
Type:symfony-bundle
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-11-13 21:06:24 UTC
README
Email bundle for test environment of Symfony2. It allows to store emails as *.eml files and read them after that.
Setup
config_test.yml
swiftmailer: transport: file
and 'swiftmailer.transport.file' instead of 'file' for SwiftmailerBundle V2.2.?
Memory transport
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); }