@@ -66,21 +66,33 @@ protected function setUp()
66
66
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetBackendModel
67
67
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsCreate
68
68
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetValue
69
+ * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetPath
70
+ * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScope
71
+ * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScopeId
72
+ * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetValue
73
+ * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsAfterLoad
69
74
* @param string $expectsValue
70
75
* @param string $className
76
+ * @param string $value
71
77
* @dataProvider processDataProvider
78
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
72
79
*/
73
80
public function testProcess (
74
81
$ hasBackendModel ,
75
82
$ expectsGetBackendModel ,
76
83
$ expectsCreate ,
77
84
$ expectsGetValue ,
85
+ $ expectsSetPath ,
86
+ $ expectsSetScope ,
87
+ $ expectsSetScopeId ,
88
+ $ expectsSetValue ,
89
+ $ expectsAfterLoad ,
78
90
$ expectsValue ,
79
- $ className
91
+ $ className ,
92
+ $ value
80
93
) {
81
94
$ scope = 'someScope ' ;
82
95
$ scopeCode = 'someScopeCode ' ;
83
- $ value = 'someValue ' ;
84
96
$ path = 'some/config/path ' ;
85
97
$ oldConfigScope = 'oldConfigScope ' ;
86
98
@@ -107,23 +119,23 @@ public function testProcess(
107
119
->disableOriginalConstructor ()
108
120
->setMethods (['setPath ' , 'setScope ' , 'setScopeId ' , 'setValue ' , 'getValue ' , 'afterLoad ' ])
109
121
->getMock ();
110
- $ backendModelMock ->expects ($ this -> once () )
122
+ $ backendModelMock ->expects ($ expectsSetPath )
111
123
->method ('setPath ' )
112
124
->with ($ path )
113
125
->willReturnSelf ();
114
- $ backendModelMock ->expects ($ this -> once () )
126
+ $ backendModelMock ->expects ($ expectsSetScope )
115
127
->method ('setScope ' )
116
128
->with ($ scope )
117
129
->willReturnSelf ();
118
- $ backendModelMock ->expects ($ this -> once () )
130
+ $ backendModelMock ->expects ($ expectsSetScopeId )
119
131
->method ('setScopeId ' )
120
132
->with ($ scopeCode )
121
133
->willReturnSelf ();
122
- $ backendModelMock ->expects ($ this -> once () )
134
+ $ backendModelMock ->expects ($ expectsSetValue )
123
135
->method ('setValue ' )
124
136
->with ($ value )
125
137
->willReturnSelf ();
126
- $ backendModelMock ->expects ($ this -> once () )
138
+ $ backendModelMock ->expects ($ expectsAfterLoad )
127
139
->method ('afterLoad ' )
128
140
->willReturnSelf ();
129
141
$ backendModelMock ->expects ($ expectsGetValue )
@@ -154,6 +166,7 @@ public function testProcess(
154
166
155
167
/**
156
168
* @return array
169
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
157
170
*/
158
171
public function processDataProvider ()
159
172
{
@@ -163,24 +176,70 @@ public function processDataProvider()
163
176
'expectsGetBackendModel ' => $ this ->once (),
164
177
'expectsCreate ' => $ this ->never (),
165
178
'expectsGetValue ' => $ this ->once (),
179
+ 'expectsSetPath ' => $ this ->once (),
180
+ 'expectsSetScope ' => $ this ->once (),
181
+ 'expectsSetScopeId ' => $ this ->once (),
182
+ 'expectsSetValue ' => $ this ->once (),
183
+ 'expectsAfterLoad ' => $ this ->once (),
166
184
'expectsValue ' => 'someValue ' ,
167
- 'className ' => Value::class
185
+ 'className ' => Value::class,
186
+ 'value ' => 'someValue '
168
187
],
169
188
[
170
189
'hasBackendModel ' => false ,
171
190
'expectsGetBackendModel ' => $ this ->never (),
172
191
'expectsCreate ' => $ this ->once (),
173
192
'expectsGetValue ' => $ this ->once (),
193
+ 'expectsSetPath ' => $ this ->once (),
194
+ 'expectsSetScope ' => $ this ->once (),
195
+ 'expectsSetScopeId ' => $ this ->once (),
196
+ 'expectsSetValue ' => $ this ->once (),
197
+ 'expectsAfterLoad ' => $ this ->once (),
174
198
'expectsValue ' => 'someValue ' ,
175
- 'className ' => Value::class
199
+ 'className ' => Value::class,
200
+ 'value ' => 'someValue '
176
201
],
177
202
[
178
203
'hasBackendModel ' => true ,
179
204
'expectsGetBackendModel ' => $ this ->once (),
180
205
'expectsCreate ' => $ this ->never (),
181
- 'expectsGetValue ' => $ this ->once (),
206
+ 'expectsGetValue ' => $ this ->never (),
207
+ 'expectsSetPath ' => $ this ->never (),
208
+ 'expectsSetScope ' => $ this ->never (),
209
+ 'expectsSetScopeId ' => $ this ->never (),
210
+ 'expectsSetValue ' => $ this ->never (),
211
+ 'expectsAfterLoad ' => $ this ->never (),
182
212
'expectsValue ' => ValueProcessor::SAFE_PLACEHOLDER ,
183
213
'className ' => Encrypted::class,
214
+ 'value ' => 'someValue '
215
+ ],
216
+ [
217
+ 'hasBackendModel ' => true ,
218
+ 'expectsGetBackendModel ' => $ this ->once (),
219
+ 'expectsCreate ' => $ this ->never (),
220
+ 'expectsGetValue ' => $ this ->once (),
221
+ 'expectsSetPath ' => $ this ->once (),
222
+ 'expectsSetScope ' => $ this ->once (),
223
+ 'expectsSetScopeId ' => $ this ->once (),
224
+ 'expectsSetValue ' => $ this ->once (),
225
+ 'expectsAfterLoad ' => $ this ->once (),
226
+ 'expectsValue ' => null ,
227
+ 'className ' => Value::class,
228
+ 'value ' => null
229
+ ],
230
+ [
231
+ 'hasBackendModel ' => true ,
232
+ 'expectsGetBackendModel ' => $ this ->once (),
233
+ 'expectsCreate ' => $ this ->never (),
234
+ 'expectsGetValue ' => $ this ->never (),
235
+ 'expectsSetPath ' => $ this ->never (),
236
+ 'expectsSetScope ' => $ this ->never (),
237
+ 'expectsSetScopeId ' => $ this ->never (),
238
+ 'expectsSetValue ' => $ this ->never (),
239
+ 'expectsAfterLoad ' => $ this ->never (),
240
+ 'expectsValue ' => null ,
241
+ 'className ' => Encrypted::class,
242
+ 'value ' => null
184
243
],
185
244
];
186
245
}
0 commit comments