3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \Config \Test \Unit \Model \Config \Reader \Source \Deployed ;
7
8
8
- use Magento \Config \Model \Config \Reader ;
9
9
use Magento \Config \Model \Config \Reader \Source \Deployed \SettingChecker ;
10
+ use Magento \Config \Model \Placeholder \PlaceholderFactory ;
11
+ use Magento \Config \Model \Placeholder \PlaceholderInterface ;
10
12
use Magento \Framework \App \Config ;
11
13
use Magento \Framework \App \DeploymentConfig ;
12
- use Magento \Config \Model \Placeholder \PlaceholderInterface ;
13
- use Magento \Config \Model \Placeholder \PlaceholderFactory ;
14
14
15
15
/**
16
16
* Test class for checking settings that defined in config file
@@ -71,15 +71,23 @@ public function setUp()
71
71
* @param string $scopeCode
72
72
* @param string|null $confValue
73
73
* @param array $variables
74
+ * @param array $configMap
74
75
* @param bool $expectedResult
75
76
* @dataProvider isReadonlyDataProvider
76
77
*/
77
- public function testIsReadonly ($ path , $ scope , $ scopeCode , $ confValue , array $ variables , $ expectedResult )
78
- {
79
- $ this ->placeholderMock ->expects ($ this ->once ())
78
+ public function testIsReadonly (
79
+ $ path ,
80
+ $ scope ,
81
+ $ scopeCode ,
82
+ $ confValue ,
83
+ array $ variables ,
84
+ array $ configMap ,
85
+ $ expectedResult
86
+ ) {
87
+ $ this ->placeholderMock ->expects ($ this ->any ())
80
88
->method ('isApplicable ' )
81
89
->willReturn (true );
82
- $ this ->placeholderMock ->expects ($ this ->once ())
90
+ $ this ->placeholderMock ->expects ($ this ->any ())
83
91
->method ('generate ' )
84
92
->with ($ path , $ scope , $ scopeCode )
85
93
->willReturn ('SOME_PLACEHOLDER ' );
@@ -95,13 +103,18 @@ public function testIsReadonly($path, $scope, $scopeCode, $confValue, array $var
95
103
96
104
$ this ->configMock ->expects ($ this ->any ())
97
105
->method ('get ' )
98
- ->willReturnMap ([
99
- [
100
- 'system/ ' . $ scope . "/ " . ($ scopeCode ? $ scopeCode . '/ ' : '' ) . $ path ,
101
- null ,
102
- $ confValue
103
- ],
104
- ]);
106
+ ->willReturnMap (
107
+ array_merge (
108
+ [
109
+ [
110
+ 'system/ ' . $ scope . "/ " . ($ scopeCode ? $ scopeCode . '/ ' : '' ) . $ path ,
111
+ null ,
112
+ $ confValue
113
+ ],
114
+ ],
115
+ $ configMap
116
+ )
117
+ );
105
118
106
119
$ this ->assertSame ($ expectedResult , $ this ->checker ->isReadOnly ($ path , $ scope , $ scopeCode ));
107
120
}
@@ -118,6 +131,7 @@ public function isReadonlyDataProvider()
118
131
'scopeCode ' => 'myWebsite ' ,
119
132
'confValue ' => 'value ' ,
120
133
'variables ' => [],
134
+ 'configMap ' => [],
121
135
'expectedResult ' => true ,
122
136
],
123
137
[
@@ -126,6 +140,7 @@ public function isReadonlyDataProvider()
126
140
'scopeCode ' => 'myWebsite ' ,
127
141
'confValue ' => null ,
128
142
'variables ' => ['SOME_PLACEHOLDER ' => 'value ' ],
143
+ 'configMap ' => [],
129
144
'expectedResult ' => true ,
130
145
],
131
146
[
@@ -134,7 +149,58 @@ public function isReadonlyDataProvider()
134
149
'scopeCode ' => 'myWebsite ' ,
135
150
'confValue ' => null ,
136
151
'variables ' => [],
152
+ 'configMap ' => [],
137
153
'expectedResult ' => false ,
154
+ ],
155
+ [
156
+ 'path ' => 'general/web/locale ' ,
157
+ 'scope ' => 'website ' ,
158
+ 'scopeCode ' => 'myWebsite ' ,
159
+ 'confValue ' => null ,
160
+ 'variables ' => [],
161
+ 'configMap ' => [
162
+ [
163
+ 'system/default/general/web/locale ' ,
164
+ null ,
165
+ 'default_value ' ,
166
+ ],
167
+ ],
168
+ 'expectedResult ' => true ,
169
+ ],
170
+ [
171
+ 'path ' => 'general/web/locale ' ,
172
+ 'scope ' => 'website ' ,
173
+ 'scopeCode ' => 'myWebsite ' ,
174
+ 'confValue ' => null ,
175
+ 'variables ' => [],
176
+ 'configMap ' => [
177
+ [
178
+ 'system/default/general/web/locale ' ,
179
+ null ,
180
+ 'default_value ' ,
181
+ ],
182
+ ],
183
+ 'expectedResult ' => true ,
184
+ ],
185
+ [
186
+ 'path ' => 'general/web/locale ' ,
187
+ 'scope ' => 'store ' ,
188
+ 'scopeCode ' => 'myStore ' ,
189
+ 'confValue ' => null ,
190
+ 'variables ' => [],
191
+ 'configMap ' => [
192
+ [
193
+ 'system/default/general/web/locale ' ,
194
+ null ,
195
+ 'default_value ' ,
196
+ ],
197
+ [
198
+ 'system/website/myWebsite/general/web/locale ' ,
199
+ null ,
200
+ null ,
201
+ ],
202
+ ],
203
+ 'expectedResult ' => true ,
138
204
]
139
205
];
140
206
}
0 commit comments