Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Commit 4addbfe

Browse files
committed
Adding full config file
1 parent fd28977 commit 4addbfe

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'transport' => "smtp",
4+
'username' =>"user",
5+
'password' => "pass",
6+
'host' => "example.org",
7+
'port' => "12345",
8+
'encryption' => "tls",
9+
'auth-mode' => "login",
10+
'timeout' => "1000",
11+
'source_ip' => "127.0.0.1",
12+
'logging' => true,
13+
'spool' => array('type' => 'memory'),
14+
'delivery_address' => 'single@host.com',
15+
'delivery_whitelist' => array('/foo@.*/', '/.*@bar.com$/'),
16+
));
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
7+
8+
<swiftmailer:config
9+
transport="smtp"
10+
username="user"
11+
password="pass"
12+
host="example.org"
13+
port="12345"
14+
encryption="tls"
15+
auth-mode="login"
16+
timeout="1000"
17+
source-ip="127.0.0.1"
18+
logging="true"
19+
delivery-address="single@host.com">
20+
<swiftmailer:antiflood/>
21+
<swiftmailer:spool type="memory"/>
22+
<swiftmailer:delivery-whitelist>
23+
<swiftmailer:pattern>/foo@.*/</swiftmailer:pattern>
24+
<swiftmailer:pattern>/.*@bar.com$/</swiftmailer:pattern>
25+
</swiftmailer:delivery-whitelist>
26+
</swiftmailer:config>
27+
</container>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
swiftmailer:
2+
transport: smtp
3+
username: user
4+
password: pass
5+
host: example.org
6+
port: 12345
7+
encryption: tls
8+
auth-mode: login
9+
timeout: 1000
10+
source_ip: 127.0.0.1
11+
logging: true
12+
spool:
13+
type: memory
14+
delivery_address: single@host.com
15+
delivery_whitelist:
16+
- /foo@.*/
17+
- /.*@bar.com$/

Tests/DependencyInjection/SwiftmailerExtensionTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,30 @@ public function testNullTransport($type)
5050
$this->assertEquals('swiftmailer.transport.null', (string) $container->getAlias('swiftmailer.transport'));
5151
}
5252

53+
/**
54+
* @dataProvider getConfigTypes
55+
*/
56+
public function testFull($type)
57+
{
58+
$container = $this->loadContainerFromFile('full', $type);
59+
60+
61+
$this->assertEquals('swiftmailer.transport.spool', (string) $container->getAlias('swiftmailer.transport'));
62+
$this->assertEquals('swiftmailer.transport.smtp', (string) $container->getAlias('swiftmailer.transport.real'));
63+
$this->assertTrue($container->has('swiftmailer.spool.memory'));
64+
$this->assertEquals('example.org', $container->getParameter('swiftmailer.transport.smtp.host'));
65+
$this->assertEquals('12345', $container->getParameter('swiftmailer.transport.smtp.port'));
66+
$this->assertEquals('tls', $container->getParameter('swiftmailer.transport.smtp.encryption'));
67+
$this->assertEquals('user', $container->getParameter('swiftmailer.transport.smtp.username'));
68+
$this->assertEquals('pass', $container->getParameter('swiftmailer.transport.smtp.password'));
69+
$this->assertEquals('login', $container->getParameter('swiftmailer.transport.smtp.auth_mode'));
70+
$this->assertEquals('1000', $container->getParameter('swiftmailer.transport.smtp.timeout'));
71+
$this->assertEquals('127.0.0.1', $container->getParameter('swiftmailer.transport.smtp.source_ip'));
72+
$this->assertSame(array('swiftmailer.plugin' => array(array())), $container->getDefinition('swiftmailer.plugin.redirecting')->getTags());
73+
$this->assertSame('single@host.com', $container->getParameter('swiftmailer.single_address'));
74+
$this->assertEquals(array('/foo@.*/', '/.*@bar.com$/'), $container->getParameter('swiftmailer.delivery_whitelist'));
75+
}
76+
5377
/**
5478
* @dataProvider getConfigTypes
5579
*/

0 commit comments

Comments
 (0)