11
11
use Magento \Framework \App \AreaList ;
12
12
use Magento \Framework \App \Cache \State ;
13
13
use Magento \Framework \App \Config \FileResolver ;
14
+ use Magento \Framework \AuthorizationInterface ;
14
15
use Magento \Framework \Config \FileIteratorFactory ;
15
16
use Magento \Framework \Config \ScopeInterface ;
16
17
use Magento \TestFramework \Helper \Bootstrap ;
17
18
18
19
/**
19
20
* @magentoAppArea adminhtml
21
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
20
22
*/
21
23
class ConfigTest extends \PHPUnit \Framework \TestCase
22
24
{
@@ -39,9 +41,8 @@ public function testLoad($query, $expectedResult)
39
41
foreach ($ expectedResult as $ itemIndex => $ expectedItem ) {
40
42
/** Validate URL to item */
41
43
$ elementPathParts = explode ('/ ' , $ expectedItem ['id ' ]);
42
- array_filter ($ elementPathParts , function ($ value ) {
43
- return $ value !== '' ;
44
- });
44
+ // filter empty values
45
+ $ elementPathParts = array_values (array_filter ($ elementPathParts ));
45
46
foreach ($ elementPathParts as $ elementPathPart ) {
46
47
$ this ->assertContains ($ elementPathPart , $ searchResults [$ itemIndex ]['url ' ], 'Item URL is invalid. ' );
47
48
}
@@ -67,6 +68,12 @@ private function getConfigSearchInstance()
67
68
->getArea (FrontNameResolver::AREA_CODE )
68
69
->load (Area::PART_CONFIG );
69
70
71
+ \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->configure ([
72
+ 'preferences ' => [
73
+ AuthorizationInterface::class => \Magento \Backend \Model \Search \AuthorizationMock::class
74
+ ]
75
+ ]);
76
+
70
77
$ fileResolverMock = $ this ->getMockBuilder (FileResolver::class)->disableOriginalConstructor ()->getMock ();
71
78
$ fileIteratorFactory = Bootstrap::getObjectManager ()->get (FileIteratorFactory::class);
72
79
$ fileIterator = $ fileIteratorFactory ->create (
@@ -110,13 +117,13 @@ public static function loadDataProvider()
110
117
'id ' => 'test_section/test_group/test_field_1 ' ,
111
118
'type ' => null ,
112
119
'name ' => 'Test Field ' ,
113
- 'description ' => '/ Test Tab / Test Section / Test Group ' ,
120
+ 'description ' => ' / Test Tab / Test Section / Test Group ' ,
114
121
],
115
122
[
116
123
'id ' => 'test_section/test_group/test_field_2 ' ,
117
124
'type ' => null ,
118
125
'name ' => 'Test Field ' ,
119
- 'description ' => '/ Test Tab / Test Section / Test Group ' ,
126
+ 'description ' => ' / Test Tab / Test Section / Test Group ' ,
120
127
],
121
128
],
122
129
],
@@ -127,7 +134,7 @@ public static function loadDataProvider()
127
134
'id ' => 'test_section/test_group ' ,
128
135
'type ' => null ,
129
136
'name ' => 'Test Group ' ,
130
- 'description ' => '/ Test Tab / Test Section ' ,
137
+ 'description ' => ' / Test Tab / Test Section ' ,
131
138
],
132
139
],
133
140
],
@@ -138,7 +145,7 @@ public static function loadDataProvider()
138
145
'id ' => '/test_section ' ,
139
146
'type ' => null ,
140
147
'name ' => 'Test Section ' ,
141
- 'description ' => '/ Test Tab ' ,
148
+ 'description ' => ' / Test Tab ' ,
142
149
],
143
150
],
144
151
],
0 commit comments