Skip to content

Commit 3fd41ce

Browse files
committed
minor #40844 [FrameworkBundle] Add basic tests for the notifier framework bundle integration (jschaedl)
This PR was merged into the 5.3-dev branch. Discussion ---------- [FrameworkBundle] Add basic tests for the notifier framework bundle integration | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> This PR adds basic tests for the notifier framework bundle integration: - [x] Adjust the symfony-1.0.xsd and define the notifier type - [x] Add general notifier configuration tests in FrameworkExtensionTest Commits ------- 47088eb Add basic notifier tests
2 parents f342892 + 47088eb commit 3fd41ce

15 files changed

+303
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<xsd:element name="http-cache" type="http_cache" minOccurs="0" maxOccurs="1" />
3737
<xsd:element name="rate-limiter" type="rate_limiter" minOccurs="0" maxOccurs="1" />
3838
<xsd:element name="uid" type="uid" minOccurs="0" maxOccurs="1" />
39+
<xsd:element name="notifier" type="notifier" minOccurs="0" maxOccurs="1" />
3940
</xsd:choice>
4041

4142
<xsd:attribute name="http-method-override" type="xsd:boolean" />
@@ -627,6 +628,7 @@
627628
<xsd:element name="envelope" type="mailer_envelope" minOccurs="0" maxOccurs="1" />
628629
<xsd:element name="header" type="header" minOccurs="0" maxOccurs="unbounded" />
629630
</xsd:sequence>
631+
<xsd:attribute name="enabled" type="xsd:boolean" />
630632
<xsd:attribute name="dsn" type="xsd:string" />
631633
<xsd:attribute name="message-bus" type="xsd:string" />
632634
</xsd:complexType>
@@ -727,4 +729,42 @@
727729
<xsd:enumeration value="1" />
728730
</xsd:restriction>
729731
</xsd:simpleType>
732+
733+
<xsd:complexType name="notifier">
734+
<xsd:sequence>
735+
<xsd:element name="chatter-transport" type="chatter-transport" minOccurs="0" maxOccurs="unbounded" />
736+
<xsd:element name="texter-transport" type="texter-transport" minOccurs="0" maxOccurs="unbounded" />
737+
<xsd:element name="channel-policy" type="channel-policy" minOccurs="0" maxOccurs="unbounded" />
738+
<xsd:element name="admin-recipients" type="admin-recipients" minOccurs="0" maxOccurs="1" />
739+
</xsd:sequence>
740+
<xsd:attribute name="enabled" type="xsd:boolean" />
741+
<xsd:attribute name="notification-on-failed-messages" type="xsd:boolean" />
742+
<xsd:attribute name="message-bus" type="xsd:string" />
743+
</xsd:complexType>
744+
745+
<xsd:complexType name="chatter-transport" mixed="true">
746+
<xsd:attribute name="name" type="xsd:string" use="required"/>
747+
</xsd:complexType>
748+
749+
<xsd:complexType name="texter-transport" mixed="true">
750+
<xsd:attribute name="name" type="xsd:string" use="required"/>
751+
</xsd:complexType>
752+
753+
<xsd:complexType name="channel-policy" mixed="true">
754+
<xsd:sequence>
755+
<xsd:element name="channel" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
756+
</xsd:sequence>
757+
<xsd:attribute name="name" type="xsd:string" use="required" />
758+
</xsd:complexType>
759+
760+
<xsd:complexType name="admin-recipients" mixed="true">
761+
<xsd:sequence>
762+
<xsd:element name="admin-recipient" type="admin-recipient" minOccurs="1" maxOccurs="unbounded" />
763+
</xsd:sequence>
764+
</xsd:complexType>
765+
766+
<xsd:complexType name="admin-recipient" mixed="true">
767+
<xsd:attribute name="email" type="xsd:string" use="required" />
768+
<xsd:attribute name="phone" type="xsd:string" />
769+
</xsd:complexType>
730770
</xsd:schema>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage;
4+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
5+
6+
$container->loadFromExtension('framework', [
7+
'messenger' => null,
8+
'mailer' => [
9+
'dsn' => 'smtp://example.com',
10+
],
11+
'notifier' => [
12+
'enabled' => true,
13+
'notification_on_failed_messages' => true,
14+
'chatter_transports' => [
15+
'slack' => 'null'
16+
],
17+
'texter_transports' => [
18+
'twilio' => 'null'
19+
],
20+
'channel_policy' => [
21+
'low' => ['slack'],
22+
'high' => ['slack', 'twilio'],
23+
],
24+
'admin_recipients' => [
25+
['email' => 'test@test.de', 'phone' => '+490815',],
26+
]
27+
],
28+
]);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage;
4+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
5+
6+
$container->loadFromExtension('framework', [
7+
'mailer' => [
8+
'enabled' => false,
9+
],
10+
'messenger' => [
11+
'enabled' => true,
12+
],
13+
'notifier' => [
14+
'enabled' => true,
15+
'notification_on_failed_messages' => true,
16+
'chatter_transports' => [
17+
'slack' => 'null'
18+
],
19+
'texter_transports' => [
20+
'twilio' => 'null'
21+
],
22+
'channel_policy' => [
23+
'low' => ['slack'],
24+
'high' => ['slack', 'twilio'],
25+
],
26+
'admin_recipients' => [
27+
['email' => 'test@test.de', 'phone' => '+490815',],
28+
]
29+
],
30+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage;
4+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
5+
6+
$container->loadFromExtension('framework', [
7+
'mailer' => [
8+
'dsn' => 'smtp://example.com',
9+
],
10+
'messenger' => [
11+
'enabled' => false,
12+
],
13+
'notifier' => [
14+
'enabled' => true,
15+
'notification_on_failed_messages' => true,
16+
'chatter_transports' => [
17+
'slack' => 'null'
18+
],
19+
'texter_transports' => [
20+
'twilio' => 'null'
21+
],
22+
'channel_policy' => [
23+
'low' => ['slack'],
24+
'high' => ['slack', 'twilio'],
25+
],
26+
'admin_recipients' => [
27+
['email' => 'test@test.de', 'phone' => '+490815',],
28+
]
29+
],
30+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage;
4+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
5+
6+
$container->loadFromExtension('framework', [
7+
'notifier' => [
8+
'enabled' => true,
9+
],
10+
]);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:messenger enabled="true" />
10+
<framework:mailer dsn="smtp://example.com" />
11+
<framework:notifier enabled="true" notification-on-failed-messages="true">
12+
<framework:chatter-transport name="slack">null</framework:chatter-transport>
13+
<framework:texter-transport name="twilio">null</framework:texter-transport>
14+
<framework:channel-policy name="low">slack</framework:channel-policy>
15+
<framework:channel-policy name="high">twilio</framework:channel-policy>
16+
<framework:admin-recipients>
17+
<framework:admin-recipient email="test@test.de" phone="+490815" />
18+
</framework:admin-recipients>
19+
</framework:notifier>
20+
</framework:config>
21+
</container>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:mailer enabled="false" />
10+
<framework:messenger enabled="true" />
11+
<framework:notifier enabled="true" notification-on-failed-messages="true">
12+
<framework:chatter-transport name="slack">null</framework:chatter-transport>
13+
<framework:texter-transport name="twilio">null</framework:texter-transport>
14+
<framework:channel-policy name="low">slack</framework:channel-policy>
15+
<framework:channel-policy name="high">twilio</framework:channel-policy>
16+
<framework:admin-recipients>
17+
<framework:admin-recipient email="test@test.de" phone="+490815" />
18+
</framework:admin-recipients>
19+
</framework:notifier>
20+
</framework:config>
21+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:mailer dsn="smtp://example.com" />
10+
<framework:messenger enabled="false" />
11+
<framework:notifier enabled="true" notification-on-failed-messages="true">
12+
<framework:chatter-transport name="slack">null</framework:chatter-transport>
13+
<framework:texter-transport name="twilio">null</framework:texter-transport>
14+
<framework:channel-policy name="low">slack</framework:channel-policy>
15+
<framework:channel-policy name="high">twilio</framework:channel-policy>
16+
<framework:admin-recipients>
17+
<framework:admin-recipient email="test@test.de" phone="+490815" />
18+
</framework:admin-recipients>
19+
</framework:notifier>
20+
</framework:config>
21+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:notifier enabled="true"></framework:notifier>
10+
</framework:config>
11+
</container>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
framework:
2+
messenger: ~
3+
mailer:
4+
dsn: 'smtp://example.com'
5+
notifier:
6+
enabled: true
7+
notification_on_failed_messages: true
8+
chatter_transports:
9+
slack: 'null'
10+
texter_transports:
11+
twilio: 'null'
12+
channel_policy:
13+
low: ['slack']
14+
high: ['slack', 'twilio']
15+
admin_recipients:
16+
- { email: 'test@test.de', phone: '+490815' }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy