@@ -74,6 +74,15 @@ class ModuleResolver
7474 */
7575 protected $ sequenceSorter ;
7676
77+ /**
78+ * List of module names that will be ignored.
79+ *
80+ * @var array
81+ */
82+ protected $ moduleBlacklist = [
83+ 'SampleTests ' ,
84+ ];
85+
7786 /**
7887 * Get ModuleResolver instance.
7988 *
@@ -157,15 +166,15 @@ protected function getModuleWhitelist()
157166 public function getModulesPath ()
158167 {
159168 if (isset ($ this ->enabledModulePaths )) {
160- return $ this ->enabledModulePaths ;
169+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
161170 }
162171
163172 $ enabledModules = $ this ->getEnabledModules ();
164173 $ modulePath = defined ('TESTS_MODULE_PATH ' ) ? TESTS_MODULE_PATH : TESTS_BP ;
165174 $ allModulePaths = glob ($ modulePath . '*/* ' );
166175 if (empty ($ enabledModules )) {
167176 $ this ->enabledModulePaths = $ allModulePaths ;
168- return $ this ->enabledModulePaths ;
177+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
169178 }
170179
171180 $ enabledModules = array_merge ($ enabledModules , $ this ->getModuleWhitelist ());
@@ -183,7 +192,7 @@ public function getModulesPath()
183192 }
184193
185194 $ this ->enabledModulePaths = $ allModulePaths ;
186- return $ this ->enabledModulePaths ;
195+ return $ this ->removeBlacklistModules ( $ this -> enabledModulePaths ) ;
187196 }
188197
189198 /**
@@ -231,4 +240,30 @@ public function sortFilesByModuleSequence(array $files)
231240 {
232241 return $ this ->sequenceSorter ->sort ($ files );
233242 }
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+ }
234269}
0 commit comments