1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Netgen\Bundle\InformationCollectionBundle\Tests\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; |
6
|
|
|
use Netgen\Bundle\InformationCollectionBundle\DependencyInjection\Configuration; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
class ConfigurationTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
use ConfigurationTestCaseTrait; |
12
|
|
|
|
13
|
|
|
public function testConfigurationValuesAreOkAndValid() |
14
|
|
|
{ |
15
|
|
|
$this->assertConfigurationIsValid( |
16
|
|
|
array( |
17
|
|
|
'netgen_information_collection' => array( |
18
|
|
|
'system' => array( |
19
|
|
|
'default' => array( |
20
|
|
|
'action_config' => array( |
21
|
|
|
'email' => array( |
22
|
|
|
'templates' => array( |
23
|
|
|
'default' => 'some_template', |
24
|
|
|
'content_types' => array( |
25
|
|
|
'content_type1' => 'content_type1_template', |
26
|
|
|
'content_type2' => 'content_type2_template', |
27
|
|
|
), |
28
|
|
|
), |
29
|
|
|
'default_variables' => array( |
30
|
|
|
'sender' => 'sender', |
31
|
|
|
'recipient' => 'recipient', |
32
|
|
|
'subject' => 'subject', |
33
|
|
|
), |
34
|
|
|
), |
35
|
|
|
), |
36
|
|
|
'actions' => array( |
37
|
|
|
'default' => array( |
38
|
|
|
'action1', |
39
|
|
|
'action2', |
40
|
|
|
), |
41
|
|
|
'content_types' => array( |
42
|
|
|
'content_type1' => array( |
43
|
|
|
'action3', |
44
|
|
|
'action4', |
45
|
|
|
), |
46
|
|
|
'content_type2' => array( |
47
|
|
|
'action5', |
48
|
|
|
'action6', |
49
|
|
|
), |
50
|
|
|
), |
51
|
|
|
), |
52
|
|
|
), |
53
|
|
|
), |
54
|
|
|
), |
55
|
|
|
) |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testConfigurationIsInvalidForDefaultTemplateValue() |
60
|
|
|
{ |
61
|
|
|
$this->assertConfigurationIsInvalid( |
62
|
|
|
array( |
63
|
|
|
'netgen_information_collection' => array( |
64
|
|
|
'system' => array( |
65
|
|
|
'default' => array( |
66
|
|
|
'action_config' => array( |
67
|
|
|
'email' => array( |
68
|
|
|
'templates' => array( |
69
|
|
|
'default' => '', |
70
|
|
|
'content_types' => array( |
71
|
|
|
'content_type1' => 'content_type1_template', |
72
|
|
|
'content_type2' => 'content_type2_template', |
73
|
|
|
), |
74
|
|
|
), |
75
|
|
|
'default_variables' => array( |
76
|
|
|
'sender' => 'sender', |
77
|
|
|
'recipient' => 'recipient', |
78
|
|
|
'subject' => 'subject', |
79
|
|
|
), |
80
|
|
|
), |
81
|
|
|
), |
82
|
|
|
'actions' => array( |
83
|
|
|
'default' => array( |
84
|
|
|
'action1', |
85
|
|
|
'action2', |
86
|
|
|
), |
87
|
|
|
'content_types' => array( |
88
|
|
|
'content_type1' => array( |
89
|
|
|
'action3', |
90
|
|
|
'action4', |
91
|
|
|
), |
92
|
|
|
'content_type2' => array( |
93
|
|
|
'action5', |
94
|
|
|
'action6', |
95
|
|
|
), |
96
|
|
|
), |
97
|
|
|
), |
98
|
|
|
), |
99
|
|
|
), |
100
|
|
|
), |
101
|
|
|
), |
102
|
|
|
'netgen_information_collection.system.default.action_config.email.templates.default' |
103
|
|
|
); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function testConfigurationIsInvalidForDefaultActionsValue() |
107
|
|
|
{ |
108
|
|
|
$this->assertConfigurationIsInvalid( |
109
|
|
|
array( |
110
|
|
|
'netgen_information_collection' => array( |
111
|
|
|
'system' => array( |
112
|
|
|
'default' => array( |
113
|
|
|
'action_config' => array( |
114
|
|
|
'email' => array( |
115
|
|
|
'templates' => array( |
116
|
|
|
'default' => 'some_template', |
117
|
|
|
'content_types' => array( |
118
|
|
|
'content_type1' => 'content_type1_template', |
119
|
|
|
'content_type2' => 'content_type2_template', |
120
|
|
|
), |
121
|
|
|
), |
122
|
|
|
'default_variables' => array( |
123
|
|
|
'sender' => 'sender', |
124
|
|
|
'recipient' => 'recipient', |
125
|
|
|
'subject' => 'subject', |
126
|
|
|
), |
127
|
|
|
), |
128
|
|
|
), |
129
|
|
|
'actions' => array( |
130
|
|
|
'default' => array( |
131
|
|
|
'', |
132
|
|
|
), |
133
|
|
|
'content_types' => array( |
134
|
|
|
'content_type1' => array( |
135
|
|
|
'action3', |
136
|
|
|
'action4', |
137
|
|
|
), |
138
|
|
|
'content_type2' => array( |
139
|
|
|
'action5', |
140
|
|
|
'action6', |
141
|
|
|
), |
142
|
|
|
), |
143
|
|
|
), |
144
|
|
|
), |
145
|
|
|
), |
146
|
|
|
), |
147
|
|
|
), |
148
|
|
|
'netgen_information_collection.system.default.actions.default' |
149
|
|
|
); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
protected function getConfiguration() |
153
|
|
|
{ |
154
|
|
|
return new Configuration(); |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|