@@ -52,48 +52,6 @@ class StructureTest extends \PHPUnit_Framework_TestCase
52
52
53
53
protected function setUp ()
54
54
{
55
- <<<<<<< HEAD
56
- $ this ->_flyweightFactory = $ this ->getMock (
57
- \Magento \Config \Model \Config \Structure \Element \FlyweightFactory::class,
58
- [],
59
- [],
60
- '' ,
61
- false
62
- );
63
- $ this ->_tabIteratorMock = $ this ->getMock (
64
- \Magento \Config \Model \Config \Structure \Element \Iterator \Tab::class,
65
- [],
66
- [],
67
- '' ,
68
- false
69
- );
70
- $ this ->_structureDataMock = $ this ->getMock (
71
- \Magento \Config \Model \Config \Structure \Data::class,
72
- [],
73
- [],
74
- '' ,
75
- false
76
- );
77
- $ this ->_scopeDefinerMock = $ this ->getMock (
78
- \Magento \Config \Model \Config \ScopeDefiner::class,
79
- [],
80
- [],
81
- '' ,
82
- false
83
- );
84
- $ this ->_scopeDefinerMock ->expects ($ this ->any ())->method ('getScope ' )->will ($ this ->returnValue ('scope ' ));
85
-
86
- $ filePath = dirname (__DIR__ ) . '/_files ' ;
87
- $ this ->_structureData = require $ filePath . '/converted_config.php ' ;
88
- $ this ->_structureDataMock ->expects (
89
- $ this ->once ()
90
- )->method (
91
- 'get '
92
- )->will (
93
- $ this ->returnValue ($ this ->_structureData ['config ' ]['system ' ])
94
- );
95
- $ this ->_model = new \Magento \Config \Model \Config \Structure (
96
- =======
97
55
$ this ->_flyweightFactory = $ this ->getMockBuilder (FlyweightFactory::class)
98
56
->disableOriginalConstructor ()
99
57
->getMock ();
@@ -117,7 +75,6 @@ protected function setUp()
117
75
->willReturn ($ this ->_structureData ['config ' ]['system ' ]);
118
76
119
77
$ this ->_model = new Structure (
120
- >>>>>>> mainline/develop
121
78
$ this ->_structureDataMock ,
122
79
$ this ->_tabIteratorMock ,
123
80
$ this ->_flyweightFactory ,
@@ -127,25 +84,6 @@ protected function setUp()
127
84
128
85
public function testGetTabsBuildsSectionTree ()
129
86
{
130
- <<<<<<< HEAD
131
- $ this ->_structureDataMock = $ this ->getMock (
132
- \Magento \Config \Model \Config \Structure \Data::class,
133
- [],
134
- [],
135
- '' ,
136
- false
137
- );
138
- $ this ->_structureDataMock ->expects (
139
- $ this ->any ()
140
- )->method (
141
- 'get '
142
- )->will (
143
- $ this ->returnValue (
144
- ['sections ' => ['section1 ' => ['tab ' => 'tab1 ' ]], 'tabs ' => ['tab1 ' => []]]
145
- )
146
- );
147
- =======
148
- >>>>>>> mainline/develop
149
87
$ expected = ['tab1 ' => ['children ' => ['section1 ' => ['tab ' => 'tab1 ' ]]]];
150
88
151
89
$ this ->_structureDataMock = $ this ->getMockBuilder (Data::class)
@@ -172,21 +110,6 @@ public function testGetTabsBuildsSectionTree()
172
110
173
111
public function testGetSectionList ()
174
112
{
175
- <<<<<<< HEAD
176
- $ this ->_structureDataMock = $ this ->getMock (
177
- \Magento \Config \Model \Config \Structure \Data::class,
178
- [],
179
- [],
180
- '' ,
181
- false
182
- );
183
- $ this ->_structureDataMock ->expects (
184
- $ this ->any ()
185
- )->method (
186
- 'get '
187
- )->will (
188
- $ this ->returnValue (
189
- =======
190
113
$ expected = [
191
114
'section1_child_id_1 ' => true ,
192
115
'section1_child_id_2 ' => true ,
@@ -200,7 +123,6 @@ public function testGetSectionList()
200
123
$ this ->_structureDataMock ->expects ($ this ->any ())
201
124
->method ('get ' )
202
125
->willReturn (
203
- >>>>>>> mainline/develop
204
126
[
205
127
'sections ' => [
206
128
'section1 ' => [
@@ -269,16 +191,6 @@ public function emptyElementDataProvider()
269
191
270
192
public function testGetElementReturnsProperElementByPath ()
271
193
{
272
- <<<<<<< HEAD
273
- $ elementMock = $ this ->getMock (
274
- \Magento \Config \Model \Config \Structure \Element \Field::class,
275
- [],
276
- [],
277
- '' ,
278
- false
279
- );
280
- =======
281
- >>>>>>> mainline/develop
282
194
$ section = $ this ->_structureData ['config ' ]['system ' ]['sections ' ]['section_1 ' ];
283
195
$ fieldData = $ section ['children ' ]['group_level_1 ' ]['children ' ]['field_3 ' ];
284
196
@@ -299,39 +211,19 @@ public function testGetElementReturnsProperElementByPath()
299
211
300
212
public function testGetElementByPathPartsIfSectionDataIsEmpty ()
301
213
{
302
- <<<<<<< HEAD
303
- $ elementMock = $ this ->getMock (
304
- \Magento \Config \Model \Config \Structure \Element \Field::class,
305
- [],
306
- [],
307
- '' ,
308
- false
309
- );
310
- =======
311
- >>>>>>> mainline/develop
312
214
$ fieldData = [
313
215
'id ' => 'field_3 ' ,
314
216
'path ' => 'section_1/group_level_1 ' ,
315
217
'_elementType ' => 'field ' ,
316
218
];
317
219
$ pathParts = explode ('/ ' , 'section_1/group_level_1/field_3 ' );
318
220
319
- <<<<<<< HEAD
320
- $ structureDataMock = $ this ->getMock (
321
- \Magento \Config \Model \Config \Structure \Data::class,
322
- [],
323
- [],
324
- '' ,
325
- false
326
- );
327
- =======
328
221
$ elementMock = $ this ->getMockBuilder (Structure \Element \Field::class)
329
222
->disableOriginalConstructor ()
330
223
->getMock ();
331
224
$ structureDataMock = $ this ->getMockBuilder (Data::class)
332
225
->disableOriginalConstructor ()
333
226
->getMock ();
334
- >>>>>>> mainline/develop
335
227
336
228
$ elementMock ->expects ($ this ->once ())
337
229
->method ('setData ' )
@@ -356,20 +248,6 @@ public function testGetElementByPathPartsIfSectionDataIsEmpty()
356
248
357
249
public function testGetFirstSectionReturnsFirstAllowedSection ()
358
250
{
359
- <<<<<<< HEAD
360
- $ tabMock = $ this ->getMock (
361
- \Magento \Config \Model \Config \Structure \Element \Tab::class,
362
- ['current ' , 'getChildren ' , 'rewind ' ],
363
- [],
364
- '' ,
365
- false
366
- );
367
- $ tabMock->expects ($ this ->any ())->method ('getChildren ' )->will ($ this ->returnSelf ());
368
- $ tabMock->expects ($ this ->once ())->method ('rewind ' );
369
- $ tabMock->expects ($ this ->once ())->method ('current ' )->will ($ this ->returnValue ('currentSection ' ));
370
- $ this ->_tabIteratorMock ->expects ($ this ->once ())->method ('rewind ' );
371
- $ this ->_tabIteratorMock ->expects ($ this ->once ())->method ('current ' )->will ($ this ->returnValue ($ tabMock ));
372
- =======
373
251
$ tabMock = $ this ->getMockBuilder (Structure \Element \Tab::class)
374
252
->disableOriginalConstructor ()
375
253
->setMethods (['current ' , 'getChildren ' , 'rewind ' ])
@@ -389,22 +267,11 @@ public function testGetFirstSectionReturnsFirstAllowedSection()
389
267
->method ('current ' )
390
268
->willReturn ($ tabMock );
391
269
392
- >>>>>>> mainline/develop
393
270
$ this ->assertEquals ('currentSection ' , $ this ->_model ->getFirstSection ());
394
271
}
395
272
396
273
public function testGetElementReturnsProperElementByPathCachesObject ()
397
274
{
398
- <<<<<<< HEAD
399
- $ elementMock = $ this ->getMock (
400
- \Magento \Config \Model \Config \Structure \Element \Field::class,
401
- [],
402
- [],
403
- '' ,
404
- false
405
- );
406
- =======
407
- >>>>>>> mainline/develop
408
275
$ section = $ this ->_structureData ['config ' ]['system ' ]['sections ' ]['section_1 ' ];
409
276
$ fieldData = $ section ['children ' ]['group_level_1 ' ]['children ' ]['field_3 ' ];
410
277
0 commit comments