@@ -74,6 +74,15 @@ class ModuleResolver
74
74
*/
75
75
protected $ sequenceSorter ;
76
76
77
+ /**
78
+ * List of module names that will be ignored.
79
+ *
80
+ * @var array
81
+ */
82
+ protected $ moduleBlacklist = [
83
+ 'SampleTests ' ,
84
+ ];
85
+
77
86
/**
78
87
* Get ModuleResolver instance.
79
88
*
@@ -157,15 +166,15 @@ protected function getModuleWhitelist()
157
166
public function getModulesPath ()
158
167
{
159
168
if (isset ($ this ->enabledModulePaths )) {
160
- return $ this ->enabledModulePaths ;
169
+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
161
170
}
162
171
163
172
$ enabledModules = $ this ->getEnabledModules ();
164
173
$ modulePath = defined ('TESTS_MODULE_PATH ' ) ? TESTS_MODULE_PATH : TESTS_BP ;
165
174
$ allModulePaths = glob ($ modulePath . '*/* ' );
166
175
if (empty ($ enabledModules )) {
167
176
$ this ->enabledModulePaths = $ allModulePaths ;
168
- return $ this ->enabledModulePaths ;
177
+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
169
178
}
170
179
171
180
$ enabledModules = array_merge ($ enabledModules , $ this ->getModuleWhitelist ());
@@ -183,7 +192,7 @@ public function getModulesPath()
183
192
}
184
193
185
194
$ this ->enabledModulePaths = $ allModulePaths ;
186
- return $ this ->enabledModulePaths ;
195
+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
187
196
}
188
197
189
198
/**
@@ -231,4 +240,30 @@ public function sortFilesByModuleSequence(array $files)
231
240
{
232
241
return $ this ->sequenceSorter ->sort ($ files );
233
242
}
243
+
244
+ /**
245
+ * Remove blacklist modules from input module paths.
246
+ *
247
+ * @param array &$modulePaths
248
+ * @return array
249
+ */
250
+ protected function removeBlacklistModules (&$ modulePaths )
251
+ {
252
+ foreach ($ modulePaths as $ index => $ modulePath ) {
253
+ if (in_array (basename ($ modulePath ), $ this ->getModuleBlacklist ())) {
254
+ unset($ modulePaths [$ index ]);
255
+ }
256
+ }
257
+ return $ modulePaths ;
258
+ }
259
+
260
+ /**
261
+ * Getter for moduleBlacklist.
262
+ *
263
+ * @return array
264
+ */
265
+ protected function getModuleBlacklist ()
266
+ {
267
+ return $ this ->moduleBlacklist ;
268
+ }
234
269
}
0 commit comments