Skip to content

Commit e202bfa

Browse files
committed
MQE-568: New .env file variable: CUSTOM_MODULE_PATHS
- apply feedback from CR
1 parent 87481ee commit e202bfa

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -249,52 +249,55 @@ public function sortFilesByModuleSequence(array $files)
249249
/**
250250
* A wrapping method for any custom logic which needs to be applied to the module list
251251
*
252-
* @param $modulesPath
253-
* @return array
252+
* @param array $modulesPath
253+
* @return string[]
254254
*/
255-
protected function applyCustomModuleMethods(&$modulesPath)
255+
protected function applyCustomModuleMethods($modulesPath)
256256
{
257-
$this->removeBlacklistModules($modulesPath);
258-
return array_merge($modulesPath, $this->getCustomModulePaths());
257+
$modulePathsResult = $this->removeBlacklistModules($modulesPath);
258+
return array_merge($modulePathsResult, $this->getCustomModulePaths());
259259
}
260260

261261
/**
262262
* Remove blacklist modules from input module paths.
263263
*
264-
* @param array &$modulePaths
265-
* @return void
264+
* @param array $modulePaths
265+
* @return string[]
266266
*/
267-
protected function removeBlacklistModules(&$modulePaths)
267+
private function removeBlacklistModules($modulePaths)
268268
{
269-
foreach ($modulePaths as $index => $modulePath) {
269+
$modulePathsResult = $modulePaths;
270+
foreach ($modulePathsResult as $index => $modulePath) {
270271
if (in_array(basename($modulePath), $this->getModuleBlacklist())) {
271-
unset($modulePaths[$index]);
272+
unset($modulePathsResult[$index]);
272273
}
273274
}
275+
276+
return $modulePathsResult;
274277
}
275278

276279
/**
277280
* Returns an array of custom module paths defined by the user
278281
*
279-
* @return array
282+
* @return string[]
280283
*/
281-
protected function getCustomModulePaths()
284+
private function getCustomModulePaths()
282285
{
283-
$custom_module_paths = getenv(self::CUSTOM_MODULE_PATHS);
286+
$customModulePaths = getenv(self::CUSTOM_MODULE_PATHS);
284287

285-
if (!$custom_module_paths) {
288+
if (!$customModulePaths) {
286289
return [];
287290
}
288291

289-
return array_map('trim', explode(',', $custom_module_paths));
292+
return array_map('trim', explode(',', $customModulePaths));
290293
}
291294

292295
/**
293296
* Getter for moduleBlacklist.
294297
*
295-
* @return array
298+
* @return string[]
296299
*/
297-
protected function getModuleBlacklist()
300+
private function getModuleBlacklist()
298301
{
299302
return $this->moduleBlacklist;
300303
}

0 commit comments

Comments
 (0)