SwiftmailerExtensionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Framework\SwiftmailerBundle\Tests\DependencyInjection;
  11. use Symfony\Framework\SwiftmailerBundle\Tests\TestCase;
  12. use Symfony\Framework\SwiftmailerBundle\DependencyInjection\SwiftmailerExtension;
  13. use Symfony\Components\DependencyInjection\BuilderConfiguration;
  14. class SwiftmailerExtensionTest extends TestCase
  15. {
  16. public function testMailerLoad()
  17. {
  18. $configuration = new BuilderConfiguration();
  19. $loader = new SwiftmailerExtension();
  20. $configuration = $loader->mailerLoad(array(), $configuration);
  21. $this->assertEquals('Swift_Mailer', $configuration->getParameter('swiftmailer.class'), '->mailerLoad() loads the swiftmailer.xml file if not already loaded');
  22. $configuration = $loader->mailerLoad(array('transport' => 'sendmail'), $configuration);
  23. $this->assertEquals('sendmail', $configuration->getParameter('swiftmailer.transport.name'), '->mailerLoad() overrides existing configuration options');
  24. $configuration = $loader->mailerLoad(array(), $configuration);
  25. $this->assertEquals('sendmail', $configuration->getParameter('swiftmailer.transport.name'), '->mailerLoad() overrides existing configuration options');
  26. }
  27. }