From e69a30b2a5c8fa92f3943cfebb264c48968842b7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 9 Feb 2012 09:51:46 +0100 Subject: [PATCH] [SwiftmailerBundle] moved the bundle to its own repository --- CHANGELOG-2.1.md | 1 + .../Command/SendEmailCommand.php | 74 --------- .../Compiler/RegisterPluginsPass.php | 36 ---- .../DependencyInjection/Configuration.php | 91 ---------- .../SwiftmailerExtension.php | 155 ------------------ .../EventListener/EmailSenderListener.php | 54 ------ .../config/schema/swiftmailer-1.0.xsd | 63 ------- .../Resources/config/smtp.xml | 27 --- .../Resources/config/spool.xml | 18 -- .../Resources/config/spool_file.xml | 16 -- .../Resources/config/spool_memory.xml | 20 --- .../Resources/config/swiftmailer.xml | 86 ---------- .../views/Collector/swiftmailer.html.twig | 45 ----- .../SwiftmailerBundle/SwiftmailerBundle.php | 31 ---- .../SwiftmailerExtensionTest.php | 57 ------- .../SwiftmailerBundle/Tests/TestCase.php | 22 --- .../Bundle/SwiftmailerBundle/composer.json | 27 --- 17 files changed, 1 insertion(+), 822 deletions(-) delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Compiler/RegisterPluginsPass.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Configuration.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/EventListener/EmailSenderListener.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/schema/swiftmailer-1.0.xsd delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/smtp.xml delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool.xml delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_file.xml delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_memory.xml delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/config/swiftmailer.xml delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/SwiftmailerBundle.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Tests/DependencyInjection/SwiftmailerExtensionTest.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/Tests/TestCase.php delete mode 100644 src/Symfony/Bundle/SwiftmailerBundle/composer.json diff --git a/CHANGELOG-2.1.md b/CHANGELOG-2.1.md index 7f44c792e27b..7ea18b37eb79 100644 --- a/CHANGELOG-2.1.md +++ b/CHANGELOG-2.1.md @@ -95,6 +95,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c ### SwiftmailerBundle + * This bundle has been moved to its own repository (https://github.com/symfony/SwiftmailerBundle) * moved the data collector to the bridge * replaced MessageLogger class with the one from Swiftmailer 4.1.3 diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php b/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php deleted file mode 100644 index f6804143a7ae..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\Command; - -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; - -/** - * Send Emails from the spool. - * - * @author Fabien Potencier - * @author Clément JOBEILI - */ -class SendEmailCommand extends ContainerAwareCommand -{ - /** - * @see Command - */ - protected function configure() - { - $this - ->setName('swiftmailer:spool:send') - ->setDescription('Sends emails from the spool') - ->addOption('message-limit', 0, InputOption::VALUE_OPTIONAL, 'The maximum number of messages to send.') - ->addOption('time-limit', 0, InputOption::VALUE_OPTIONAL, 'The time limit for sending messages (in seconds).') - ->addOption('recover-timeout', 0, InputOption::VALUE_OPTIONAL, 'The timeout for recovering messages that have taken too long to send (in seconds).') - ->setHelp(<<swiftmailer:spool:send command sends all emails from the spool. - -php app/console swiftmailer:spool:send --message-limit=10 --time-limit=10 --recover-timeout=900 - -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $mailer = $this->getContainer()->get('mailer'); - $transport = $mailer->getTransport(); - - if ($transport instanceof \Swift_Transport_SpoolTransport) { - $spool = $transport->getSpool(); - if ($spool instanceof \Swift_ConfigurableSpool) { - $spool->setMessageLimit($input->getOption('message-limit')); - $spool->setTimeLimit($input->getOption('time-limit')); - } - if ($spool instanceof \Swift_FileSpool) { - if (null !== $input->getOption('recover-timeout')) { - $spool->recover($input->getOption('recover-timeout')); - } else { - $spool->recover(); - } - } - $sent = $spool->flushQueue($this->getContainer()->get('swiftmailer.transport.real')); - - $output->writeln(sprintf('sent %s emails', $sent)); - } - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Compiler/RegisterPluginsPass.php b/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Compiler/RegisterPluginsPass.php deleted file mode 100644 index 63a12dc121f9..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Compiler/RegisterPluginsPass.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -/** - * RegisterPluginsPass registers Swiftmailer plugins. - * - * @author Fabien Potencier - */ -class RegisterPluginsPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition('swiftmailer.mailer')) { - return; - } - - $definition = $container->findDefinition('swiftmailer.transport'); - foreach ($container->findTaggedServiceIds('swiftmailer.plugin') as $id => $args) { - $definition->addMethodCall('registerPlugin', array(new Reference($id))); - } - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Configuration.php deleted file mode 100644 index c4c12d1bd0aa..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/Configuration.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\DependencyInjection; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\ConfigurationInterface; - -/** - * This class contains the configuration information for the bundle - * - * This information is solely responsible for how the different configuration - * sections are normalized, and merged. - * - * @author Christophe Coevoet - */ -class Configuration implements ConfigurationInterface -{ - private $debug; - - /** - * Constructor. - * - * @param Boolean $debug The kernel.debug value - */ - public function __construct($debug) - { - $this->debug = (Boolean) $debug; - } - - /** - * Generates the configuration tree builder. - * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder - */ - public function getConfigTreeBuilder() - { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('swiftmailer'); - - $rootNode - ->children() - ->scalarNode('transport')->defaultValue('smtp')->end() - ->scalarNode('username')->defaultNull()->end() - ->scalarNode('password')->defaultNull()->end() - ->scalarNode('host')->defaultValue('localhost')->end() - ->scalarNode('port')->defaultFalse()->end() - ->scalarNode('encryption') - ->defaultNull() - ->validate() - ->ifNotInArray(array('tls', 'ssl', null)) - ->thenInvalid('The %s encryption is not supported') - ->end() - ->end() - ->scalarNode('auth_mode') - ->defaultNull() - ->validate() - ->ifNotInArray(array('plain', 'login', 'cram-md5', null)) - ->thenInvalid('The %s authentication mode is not supported') - ->end() - ->end() - ->arrayNode('spool') - ->children() - ->scalarNode('type')->defaultValue('file')->end() - ->scalarNode('path')->defaultValue('%kernel.cache_dir%/swiftmailer/spool')->end() - ->end() - ->end() - ->scalarNode('sender_address')->end() - ->arrayNode('antiflood') - ->children() - ->scalarNode('threshold')->defaultValue(99)->end() - ->scalarNode('sleep')->defaultValue(0)->end() - ->end() - ->end() - ->scalarNode('delivery_address')->end() - ->booleanNode('disable_delivery')->end() - ->booleanNode('logging')->defaultValue($this->debug)->end() - ->end() - ; - - return $treeBuilder; - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php b/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php deleted file mode 100644 index 86e0b2938ff5..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\DependencyInjection; - -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Config\FileLocator; - -/** - * SwiftmailerExtension is an extension for the SwiftMailer library. - * - * @author Fabien Potencier - */ -class SwiftmailerExtension extends Extension -{ - /** - * Loads the Swift Mailer configuration. - * - * Usage example: - * - * - * fabien - * xxxxx - * - * - * - * @param array $configs An array of configuration settings - * @param ContainerBuilder $container A ContainerBuilder instance - */ - public function load(array $configs, ContainerBuilder $container) - { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('swiftmailer.xml'); - $container->setAlias('mailer', 'swiftmailer.mailer'); - - $configuration = $this->getConfiguration($configs, $container); - $config = $this->processConfiguration($configuration, $configs); - - if (null === $config['transport']) { - $transport = 'null'; - } elseif ('gmail' === $config['transport']) { - $config['encryption'] = 'ssl'; - $config['auth_mode'] = 'login'; - $config['host'] = 'smtp.gmail.com'; - $transport = 'smtp'; - } else { - $transport = $config['transport']; - } - - if (isset($config['disable_delivery']) && $config['disable_delivery']) { - $transport = 'null'; - } - - if ('smtp' === $transport) { - $loader->load('smtp.xml'); - } - - if (in_array($transport, array('smtp', 'mail', 'sendmail', 'null'))) { - // built-in transport - $transport = 'swiftmailer.transport.'.$transport; - } - - $container->setAlias('swiftmailer.transport', $transport); - - if (false === $config['port']) { - $config['port'] = 'ssl' === $config['encryption'] ? 465 : 25; - } - - foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode') as $key) { - $container->setParameter('swiftmailer.transport.smtp.'.$key, $config[$key]); - } - - // spool? - if (isset($config['spool'])) { - $type = $config['spool']['type']; - - $loader->load('spool.xml'); - if ($type === 'file') { - $loader->load('spool_file.xml'); - } elseif ($type === 'memory') { - $loader->load('spool_memory.xml'); - } - $container->setAlias('swiftmailer.transport.real', $transport); - $container->setAlias('swiftmailer.transport', 'swiftmailer.transport.spool'); - $container->setAlias('swiftmailer.spool', 'swiftmailer.spool.'.$type); - - foreach (array('path') as $key) { - $container->setParameter('swiftmailer.spool.'.$type.'.'.$key, $config['spool'][$key]); - } - } - $container->setParameter('swiftmailer.spool.enabled', isset($config['spool'])); - - // antiflood? - if (isset($config['antiflood'])) { - $container->setParameter('swiftmailer.plugin.antiflood.threshold', $config['antiflood']['threshold']); - $container->setParameter('swiftmailer.plugin.antiflood.sleep', $config['antiflood']['sleep']); - - $container->getDefinition('swiftmailer.plugin.antiflood')->addTag('swiftmailer.plugin'); - } - - if ($config['logging']) { - $container->getDefinition('swiftmailer.plugin.messagelogger')->addTag('swiftmailer.plugin'); - $container->findDefinition('swiftmailer.data_collector')->addTag('data_collector', array('template' => 'SwiftmailerBundle:Collector:swiftmailer', 'id' => 'swiftmailer')); - } - - if (isset($config['sender_address']) && $config['sender_address']) { - $container->setParameter('swiftmailer.sender_address', $config['sender_address']); - $container->getDefinition('swiftmailer.plugin.impersonate')->addTag('swiftmailer.plugin'); - } else { - $container->setParameter('swiftmailer.sender_address', null); - } - - if (isset($config['delivery_address']) && $config['delivery_address']) { - $container->setParameter('swiftmailer.single_address', $config['delivery_address']); - $container->getDefinition('swiftmailer.plugin.redirecting')->addTag('swiftmailer.plugin'); - } else { - $container->setParameter('swiftmailer.single_address', null); - } - } - - /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path - */ - public function getXsdValidationBasePath() - { - return __DIR__.'/../Resources/config/schema'; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://symfony.com/schema/dic/swiftmailer'; - } - - public function getConfiguration(array $config, ContainerBuilder $container) - { - return new Configuration($container->getParameter('kernel.debug')); - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/EventListener/EmailSenderListener.php b/src/Symfony/Bundle/SwiftmailerBundle/EventListener/EmailSenderListener.php deleted file mode 100644 index 3a8a5701e1c5..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/EventListener/EmailSenderListener.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\EventListener; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Sends emails for the memory spool. - * - * Emails are sent on the kernel.terminate event. - * - * @author Fabien Potencier - */ -class EmailSenderListener implements EventSubscriberInterface -{ - private $container; - - public function __construct(ContainerInterface $container, $autoStart = false) - { - $this->container = $container; - } - - public function onKernelTerminate(PostResponseEvent $event) - { - $transport = $this->container->get('mailer')->getTransport(); - if (!$transport instanceof \Swift_Transport_SpoolTransport) { - return; - } - - $spool = $transport->getSpool(); - if (!$spool instanceof \Swift_MemorySpool) { - return; - } - - $spool->flushQueue($this->container->get('swiftmailer.transport.real')); - } - - static public function getSubscribedEvents() - { - return array(KernelEvents::TERMINATE => 'onKernelTerminate'); - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/schema/swiftmailer-1.0.xsd b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/schema/swiftmailer-1.0.xsd deleted file mode 100644 index cc896d01e1b7..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/schema/swiftmailer-1.0.xsd +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/smtp.xml b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/smtp.xml deleted file mode 100644 index 7100f47ac6a6..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/smtp.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Swift_Transport_EsmtpTransport - - - - - - - - - - - %swiftmailer.transport.smtp.host% - %swiftmailer.transport.smtp.port% - %swiftmailer.transport.smtp.encryption% - %swiftmailer.transport.smtp.username% - %swiftmailer.transport.smtp.password% - %swiftmailer.transport.smtp.auth_mode% - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool.xml b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool.xml deleted file mode 100644 index d9009d7b1a19..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - Swift_Plugins_RedirectingPlugin - Swift_Plugins_BlackholePlugin - - - - - - - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_file.xml b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_file.xml deleted file mode 100644 index b452553e8777..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_file.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Swift_FileSpool - - - - - %swiftmailer.spool.file.path% - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_memory.xml b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_memory.xml deleted file mode 100644 index eefe6607f1a4..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/spool_memory.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - Swift_MemorySpool - Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener - - - - - - - - - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/swiftmailer.xml b/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/swiftmailer.xml deleted file mode 100644 index 57753bf65d3b..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/config/swiftmailer.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - Swift_Mailer - - Swift_Transport_SendmailTransport - Swift_Transport_MailTransport - - Swift_Transport_FailoverTransport - - Swift_Plugins_RedirectingPlugin - Swift_Plugins_ImpersonatePlugin - Swift_Plugins_MessageLogger - Swift_Plugins_AntiFloodPlugin - 99 - 0 - - Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %swiftmailer.single_address% - - - - %swiftmailer.plugin.antiflood.threshold% - %swiftmailer.plugin.antiflood.sleep% - - - - %swiftmailer.sender_address% - - - - - - - %swiftmailer.spool.enabled% - - - - - diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig b/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig deleted file mode 100644 index a7c0b10b0551..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig +++ /dev/null @@ -1,45 +0,0 @@ -{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} - -{% block toolbar %} - {% if collector.messagecount %} - {% set icon %} - Swiftmailer - {% endset %} - {% set text %} - {{ collector.messagecount }} - {% endset %} - {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %} - {% endif %} -{% endblock %} - -{% block menu %} - - Configuration - E-Mails - - {{ collector.messagecount }} - - -{% endblock %} - -{% block panel %} -

Messages {{ collector.isSpool ? 'spooled' : 'sent' }}

- - {% if not collector.messages %} -

- No message sent. -

- {% else %} - {% for i, message in collector.messages %} -

Message {{ i + 1 }} / {{ collector.messagecount }}

- - {% for header in message.headers.all %} -
{{ header }}
- {% endfor %} - -

-

{{ message.body|e('html', message.charset)|convert_encoding('UTF-8', message.charset) }}
-

- {% endfor %} - {% endif %} -{% endblock %} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/SwiftmailerBundle.php b/src/Symfony/Bundle/SwiftmailerBundle/SwiftmailerBundle.php deleted file mode 100644 index 8456bbf59aa4..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/SwiftmailerBundle.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Bundle\SwiftmailerBundle\DependencyInjection\Compiler\RegisterPluginsPass; - -/** - * Bundle. - * - * @author Fabien Potencier - */ -class SwiftmailerBundle extends Bundle -{ - public function build(ContainerBuilder $container) - { - parent::build($container); - - $container->addCompilerPass(new RegisterPluginsPass()); - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Tests/DependencyInjection/SwiftmailerExtensionTest.php b/src/Symfony/Bundle/SwiftmailerBundle/Tests/DependencyInjection/SwiftmailerExtensionTest.php deleted file mode 100644 index 9d72ddf3cd3c..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Tests/DependencyInjection/SwiftmailerExtensionTest.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\Tests\DependencyInjection; - -use Symfony\Bundle\SwiftmailerBundle\Tests\TestCase; -use Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -class SwiftmailerExtensionTest extends TestCase -{ - public function testConfigLoad() - { - $container = new ContainerBuilder(); - $container->setParameter('kernel.debug', false); - $loader = new SwiftmailerExtension(); - - $loader->load(array(array()), $container); - $this->assertEquals('Swift_Mailer', $container->getParameter('swiftmailer.class'), '->load() loads the swiftmailer.xml file if not already loaded'); - - $loader->load(array(array('transport' => 'sendmail')), $container); - $this->assertEquals('swiftmailer.transport.sendmail', (string) $container->getAlias('swiftmailer.transport')); - - $loader->load(array(array()), $container); - $this->assertEquals('swiftmailer.transport.smtp', (string) $container->getAlias('swiftmailer.transport')); - } - - public function testNullTransport() - { - $container = new ContainerBuilder(); - $container->setParameter('kernel.debug', false); - $loader = new SwiftmailerExtension(); - - $loader->load(array(array('transport' => null)), $container); - $this->assertEquals('swiftmailer.transport.null', (string) $container->getAlias('swiftmailer.transport')); - } - - public function testSpool() - { - $container = new ContainerBuilder(); - $container->setParameter('kernel.debug', false); - $loader = new SwiftmailerExtension(); - - $loader->load(array(array('spool' => array())), $container); - $this->assertEquals('swiftmailer.transport.spool', (string) $container->getAlias('swiftmailer.transport')); - $this->assertEquals('swiftmailer.transport.smtp', (string) $container->getAlias('swiftmailer.transport.real')); - } - -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Tests/TestCase.php b/src/Symfony/Bundle/SwiftmailerBundle/Tests/TestCase.php deleted file mode 100644 index b65b64ad6fd1..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/Tests/TestCase.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\SwiftmailerBundle\Tests; - -class TestCase extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - if (!class_exists('Swift_Mailer')) { - $this->markTestSkipped('Swiftmailer is not available.'); - } - } -} diff --git a/src/Symfony/Bundle/SwiftmailerBundle/composer.json b/src/Symfony/Bundle/SwiftmailerBundle/composer.json deleted file mode 100644 index bb130804ad55..000000000000 --- a/src/Symfony/Bundle/SwiftmailerBundle/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "symfony/swiftmailer-bundle", - "type": "symfony-bundle", - "description": "Symfony SwiftmailerBundle", - "keywords": [], - "homepage": "http://symfony.com", - "version": "2.1.0", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2", - "symfony/swiftmailer-bridge": "self.version" - }, - "autoload": { - "psr-0": { "Symfony\\Bundle\\SwiftmailerBundle": "" } - }, - "target-dir": "Symfony/Bundle/SwiftmailerBundle" -}