diff --git a/CHANGELOG.md b/CHANGELOG.md index c285d511b..4f6b83810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -177,9 +177,9 @@ Magento Functional Testing Framework Changelog * Command verifies and troubleshoots some configuration steps required for running tests * Please see DevDocs for more details * `<*Data>` actions now contain `API Endpoint` and `Request Header` artifacts. - * Introduced new `.env` configurations `ENABLE_BROWSER_LOG` and `BROWSER_LOG_BLACKLIST` + * Introduced new `.env` configurations `ENABLE_BROWSER_LOG` and `BROWSER_LOG_BLOCKLIST` * Configuration enables allure artifacts for browser log entries if they are present after the step. - * Blacklist filters out logs from specific sources. + * Blocklist filters out logs from specific sources. * Customizability * Introduced `timeout=""` to `magentoCLI` actions. diff --git a/bin/blacklist.txt b/bin/blocklist.txt similarity index 96% rename from bin/blacklist.txt rename to bin/blocklist.txt index 39b3a6700..6d9f6f4e2 100644 --- a/bin/blacklist.txt +++ b/bin/blocklist.txt @@ -3,7 +3,7 @@ # # # THIS FILE CANNOT CONTAIN BLANK LINES # ################################################################### -bin/blacklist.txt +bin/blocklist.txt dev/tests/static/Magento/Sniffs/Commenting/FunctionCommentSniff.php dev/tests/static/Magento/Sniffs/Commenting/VariableCommentSniff.php dev/tests/verification/_generated diff --git a/bin/copyright-check b/bin/copyright-check index 79fe8df06..dc9976d77 100755 --- a/bin/copyright-check +++ b/bin/copyright-check @@ -5,13 +5,13 @@ FILE_EXTENSIONS='.php\|.xml\|.xsd' -BLACKLIST='bin/blacklist.txt' +BLOCKLIST='bin/blocklist.txt' RESULT='' # Iterate through the list of tracked files # that have the expected extensions # that are not ignored -for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLACKLIST` +for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLOCKLIST` do if echo `cat $i` | grep -q -v "Copyright © Magento, Inc. All rights reserved."; then # Copyright is missing diff --git a/bin/copyright-check.bat b/bin/copyright-check.bat index 9f2e23bfb..0a7612f77 100644 --- a/bin/copyright-check.bat +++ b/bin/copyright-check.bat @@ -3,7 +3,7 @@ @echo off SETLOCAL EnableDelayedExpansion -SET BLACKLIST_FILE=bin/blacklist.txt +SET BLOCKLIST_FILE=bin/blocklist.txt SET i=0 FOR /F %%x IN ('git ls-tree --full-tree -r --name-only HEAD') DO ( @@ -12,14 +12,14 @@ FOR /F %%x IN ('git ls-tree --full-tree -r --name-only HEAD') DO ( if "%%~xx"==".xml" set GOOD_EXT=1 if "%%~xx"==".xsd" set GOOD_EXT=1 IF DEFINED GOOD_EXT ( - SET BLACKLISTED= - FOR /F "tokens=* skip=5" %%f IN (%BLACKLIST_FILE%) DO ( + SET BLOCKLISTED= + FOR /F "tokens=* skip=5" %%f IN (%BLOCKLIST_FILE%) DO ( SET LINE=%%x IF NOT "!LINE!"=="!LINE:%%f=!" ( - SET BLACKLISTED=1 + SET BLOCKLISTED=1 ) ) - IF NOT DEFINED BLACKLISTED ( + IF NOT DEFINED BLOCKLISTED ( FIND "Copyright © Magento, Inc. All rights reserved." %%x >nul IF ERRORLEVEL 1 ( SET /A i+=1 diff --git a/dev/tests/_bootstrap.php b/dev/tests/_bootstrap.php index 66be4ee45..059441721 100644 --- a/dev/tests/_bootstrap.php +++ b/dev/tests/_bootstrap.php @@ -54,8 +54,8 @@ putenv("{$key}=${value}"); } -// Add our test module to the whitelist -putenv('MODULE_WHITELIST=Magento_TestModule'); +// Add our test module to the allowlist +putenv('MODULE_ALLOWLIST=Magento_TestModule'); // Define our own set of paths for the tests defined('FW_BP') || define('FW_BP', PROJECT_ROOT); diff --git a/dev/tests/static/Magento/Sniffs/MicroOptimizations/IsNullSniff.php b/dev/tests/static/Magento/Sniffs/MicroOptimizations/IsNullSniff.php index 928fc3a0d..9ec74cb4f 100644 --- a/dev/tests/static/Magento/Sniffs/MicroOptimizations/IsNullSniff.php +++ b/dev/tests/static/Magento/Sniffs/MicroOptimizations/IsNullSniff.php @@ -13,7 +13,7 @@ class IsNullSniff implements Sniff /** * @var string */ - protected $blacklist = 'is_null'; + protected $blocklist = 'is_null'; /** * @inheritdoc @@ -29,7 +29,7 @@ public function register() public function process(File $sourceFile, $stackPtr) { $tokens = $sourceFile->getTokens(); - if ($tokens[$stackPtr]['content'] === $this->blacklist) { + if ($tokens[$stackPtr]['content'] === $this->blocklist) { $sourceFile->addError( "is_null must be avoided. Use strict comparison instead.", $stackPtr, diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php index 81b162981..c554062fd 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php @@ -705,12 +705,12 @@ public function testApplyCustomModuleMethods() } /** - * Validate blacklisted modules are removed + * Validate blocklisted modules are removed * Module paths are sorted according to module name in alphabetically ascending order * * @throws \Exception */ - public function testGetModulePathsBlacklist() + public function testGetModulePathsBlocklist() { $this->setMockResolverClass( false, @@ -946,10 +946,10 @@ private function setMockResolverClass( * @param ModuleResolver $instance * @param array $mockPaths * @param array $mockModules - * @param array $mockBlacklist + * @param array $mockBlocklist * @throws \Exception */ - private function setMockResolverProperties($instance, $mockPaths = null, $mockModules = null, $mockBlacklist = []) + private function setMockResolverProperties($instance, $mockPaths = null, $mockModules = null, $mockBlocklist = []) { $property = new \ReflectionProperty(ModuleResolver::class, 'enabledModulePaths'); $property->setAccessible(true); @@ -959,9 +959,9 @@ private function setMockResolverProperties($instance, $mockPaths = null, $mockMo $property->setAccessible(true); $property->setValue($instance, $mockModules); - $property = new \ReflectionProperty(ModuleResolver::class, 'moduleBlacklist'); + $property = new \ReflectionProperty(ModuleResolver::class, 'moduleBlocklist'); $property->setAccessible(true); - $property->setValue($instance, $mockBlacklist); + $property->setValue($instance, $mockBlocklist); } /** diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Util/Validation/NameValidationUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Util/Validation/NameValidationUtilTest.php index e9854be40..d43eb5282 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Util/Validation/NameValidationUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Util/Validation/NameValidationUtilTest.php @@ -17,7 +17,7 @@ class NameValidationUtilTest extends MagentoTestCase */ public function testCurlyBracesInTestName() { - $this->validateBlacklistedTestName("{{curlyBraces}}"); + $this->validateBlocklistedTestName("{{curlyBraces}}"); } /** @@ -25,7 +25,7 @@ public function testCurlyBracesInTestName() */ public function testQuotesInTestName() { - $this->validateBlacklistedTestName("\"quotes\""); + $this->validateBlocklistedTestName("\"quotes\""); } /** @@ -33,7 +33,7 @@ public function testQuotesInTestName() */ public function testSingleQuotesInTestName() { - $this->validateBlacklistedTestName("'singleQuotes'"); + $this->validateBlocklistedTestName("'singleQuotes'"); } /** @@ -41,7 +41,7 @@ public function testSingleQuotesInTestName() */ public function testParenthesesInTestName() { - $this->validateBlacklistedTestName("(parenthesis)"); + $this->validateBlocklistedTestName("(parenthesis)"); } /** @@ -49,7 +49,7 @@ public function testParenthesesInTestName() */ public function testDollarSignInTestName() { - $this->validateBlacklistedTestName("\$dollarSign\$"); + $this->validateBlocklistedTestName("\$dollarSign\$"); } /** @@ -57,7 +57,7 @@ public function testDollarSignInTestName() */ public function testSpacesInTestName() { - $this->validateBlacklistedTestName("Test Name With Spaces"); + $this->validateBlocklistedTestName("Test Name With Spaces"); } /** @@ -66,7 +66,7 @@ public function testSpacesInTestName() * @param string $testName * @return void */ - private function validateBlacklistedTestName($testName) + private function validateBlocklistedTestName($testName) { $this->expectException(XmlException::class); NameValidationUtil::validateName($testName, "Test"); diff --git a/docs/configuration.md b/docs/configuration.md index 5a912b66c..b78b421b9 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -214,15 +214,15 @@ Example: TESTS_MODULE_PATH=~/magento2/dev/tests/acceptance/tests/functional/Magento/FunctionalTest ``` -### MODULE_WHITELIST +### MODULE_ALLOWLIST Use for a new module. -When adding a new directory at `Magento/FunctionalTest`, add the directory name to `MODULE_WHITELIST` to enable the MFTF to process it. +When adding a new directory at `Magento/FunctionalTest`, add the directory name to `MODULE_ALLOWLIST` to enable the MFTF to process it. Example: ```conf -MODULE_WHITELIST=Magento_Framework,Magento_ConfigurableProductWishlist,Magento_ConfigurableProductCatalogSearch +MODULE_ALLOWLIST=Magento_Framework,Magento_ConfigurableProductWishlist,Magento_ConfigurableProductCatalogSearch ``` ### MAGENTO_CLI_COMMAND_PATH @@ -331,14 +331,14 @@ Use this if you're having issues with sessions hanging in an MFTF suite. SELENIUM_CLOSE_ALL_SESSIONS=true ``` -### BROWSER_LOG_BLACKLIST +### BROWSER_LOG_BLOCKLIST -Blacklists types of browser log entries from appearing in Allure steps. +Blocklists types of browser log entries from appearing in Allure steps. Denoted in browser log entry as `"SOURCE": "type"`. ```conf -BROWSER_LOG_BLACKLIST=other,console-api +BROWSER_LOG_BLOCKLIST=other,console-api ``` ### WAIT_TIMEOUT diff --git a/etc/codecoverage/index.php b/etc/codecoverage/index.php deleted file mode 100644 index 5ae6c7e3f..000000000 --- a/etc/codecoverage/index.php +++ /dev/null @@ -1,58 +0,0 @@ -createApplication(\Magento\Framework\App\Http::class); - * $bootstrap->run($app); - * -------------------------------------------- - * - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -try { - require __DIR__ . '/app/bootstrap.php'; -} catch (\Exception $e) { - echo << -
-

- Autoload error

-
-

{$e->getMessage()}

- -HTML; - exit(1); -} - -//Patch start -$driver = new pcov\Clobber\Driver\PHPUnit6(); -$coverage = new \SebastianBergmann\CodeCoverage\CodeCoverage($driver); -$coverage->filter()->addDirectoryToWhitelist("app/code/Magento/*"); -$coverage->filter()->removeDirectoryFromWhitelist("app/code/Magento/*/Test"); -$testName = "NO_TEST_NAME"; -if (file_exists(__DIR__ . '/CURRENT_TEST')) { - $testName = file_get_contents(__DIR__ . '/CURRENT_TEST'); -} -$id = !empty($testName) ? $testName : "NO_TEST_NAME"; -$coverage->start($id); -//Patch end - -$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); -/** @var \Magento\Framework\App\Http $app */ -$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class); -$bootstrap->run($app); - -// Patch start -$coverage->stop(); -$writer = new \SebastianBergmann\CodeCoverage\Report\PHP(); -$writer->process($coverage, '/var/www/html/coverage/reports/' . $id . "_" . md5(mt_rand()) . '.cov'); -// Patch end diff --git a/etc/codecoverage/test.php b/etc/codecoverage/test.php deleted file mode 100644 index a43388a2c..000000000 --- a/etc/codecoverage/test.php +++ /dev/null @@ -1,10 +0,0 @@ -getDriver()->webDriver->manage()->getLog("browser"); if (getenv('ENABLE_BROWSER_LOG') === 'true') { - foreach (explode(',', getenv('BROWSER_LOG_BLACKLIST')) as $source) { + foreach (explode(',', getenv('BROWSER_LOG_BLOCKLIST')) as $source) { $browserLog = BrowserLogUtil::filterLogsOfType($browserLog, $source); } if (!empty($browserLog)) { diff --git a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php index 8dcf090f0..73695c182 100644 --- a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php @@ -23,7 +23,7 @@ class PageObjectHandler implements ObjectHandlerInterface const PARAMETERIZED = 'parameterized'; const AREA = 'area'; const FILENAME = 'filename'; - const NAME_BLACKLIST_ERROR_MSG = "Page names cannot contain non alphanumeric characters.\tPage='%s'"; + const NAME_BLOCKLIST_ERROR_MSG = "Page names cannot contain non alphanumeric characters.\tPage='%s'"; /** * The singleton instance of this class @@ -58,7 +58,7 @@ private function __construct() $pageNameValidator = new NameValidationUtil(); foreach ($parserOutput as $pageName => $pageData) { if (preg_match('/[^a-zA-Z0-9_]/', $pageName)) { - throw new XmlException(sprintf(self::NAME_BLACKLIST_ERROR_MSG, $pageName)); + throw new XmlException(sprintf(self::NAME_BLOCKLIST_ERROR_MSG, $pageName)); } $filename = $pageData[self::FILENAME] ?? null; diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php index d9b8d32fb..03813315f 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php @@ -27,7 +27,7 @@ class ActionObjectExtractor extends BaseObjectExtractor const ACTION_GROUP_ARGUMENTS = 'arguments'; const ACTION_GROUP_ARG_VALUE = 'value'; const BEFORE_AFTER_ERROR_MSG = "Merge Error - Steps cannot have both before and after attributes.\tStepKey='%s'"; - const STEP_KEY_BLACKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters.\tStepKey='%s'"; + const STEP_KEY_BLOCKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters.\tStepKey='%s'"; const STEP_KEY_EMPTY_ERROR_MSG = "StepKeys cannot be empty.\tAction='%s'"; const DATA_PERSISTENCE_CUSTOM_FIELD = 'field'; const DATA_PERSISTENCE_CUSTOM_FIELD_KEY = 'key'; @@ -70,7 +70,7 @@ public function extractActions($testActions, $testName = null) } if (preg_match('/[^a-zA-Z0-9_]/', $stepKey)) { - throw new XmlException(sprintf(self::STEP_KEY_BLACKLIST_ERROR_MSG, $actionName)); + throw new XmlException(sprintf(self::STEP_KEY_BLOCKLIST_ERROR_MSG, $actionName)); } $actionAttributes = $this->stripDescriptorTags( diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php b/src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php index cfe417dc9..ff3a1e5f8 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php @@ -90,7 +90,7 @@ public function getAnnotationExtractor() */ public function extractTestData($testData, $validateAnnotations = true) { - // validate the test name for blacklisted char (will cause allure report issues) MQE-483 + // validate the test name for blocklisted char (will cause allure report issues) MQE-483 NameValidationUtil::validateName($testData[self::NAME], "Test"); $testAnnotations = []; diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index c16b309ef..ecdf19613 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -25,9 +25,9 @@ class ModuleResolver { /** - * Environment field name for module whitelist. + * Environment field name for module allowlist. */ - const MODULE_WHITELIST = 'MODULE_WHITELIST'; + const MODULE_ALLOWLIST = 'MODULE_ALLOWLIST'; /** * Environment field name for custom module paths. @@ -132,7 +132,7 @@ class ModuleResolver * * @var array */ - protected $moduleBlacklist = [ + protected $moduleBlocklist = [ 'SampleTests', 'SampleTemplates' ]; @@ -270,7 +270,7 @@ public function getModulesPath($verbosePath = false) return $this->enabledModulePaths; } - $enabledModules = array_merge($this->getEnabledModules(), $this->getModuleWhitelist()); + $enabledModules = array_merge($this->getEnabledModules(), $this->getModuleAllowlist()); $enabledDirectoryPaths = $this->flipAndFilterModulePathsArray($allModulePaths, $enabledModules); $this->enabledModulePaths = $this->applyCustomModuleMethods($enabledDirectoryPaths); @@ -289,18 +289,18 @@ public function sortFilesByModuleSequence(array $files) } /** - * Return an array of module whitelist that not exist in target Magento instance. + * Return an array of module allowlist that not exist in target Magento instance. * * @return array */ - protected function getModuleWhitelist() + protected function getModuleAllowlist() { - $moduleWhitelist = getenv(self::MODULE_WHITELIST); + $moduleAllowlist = getenv(self::MODULE_ALLOWLIST); - if (empty($moduleWhitelist)) { + if (empty($moduleAllowlist)) { return []; } - return array_map('trim', explode(',', $moduleWhitelist)); + return array_map('trim', explode(',', $moduleAllowlist)); } /** @@ -693,7 +693,7 @@ private function printMagentoVersionInfo() */ protected function applyCustomModuleMethods($modulesPath) { - $modulePathsResult = $this->removeBlacklistModules($modulesPath); + $modulePathsResult = $this->removeBlocklistModules($modulesPath); $customModulePaths = $this->getCustomModulePaths(); array_map(function ($key, $value) { @@ -710,17 +710,17 @@ protected function applyCustomModuleMethods($modulesPath) } /** - * Remove blacklist modules from input module paths. + * Remove blocklist modules from input module paths. * * @param array $modulePaths * @return string[] */ - private function removeBlacklistModules($modulePaths) + private function removeBlocklistModules($modulePaths) { $modulePathsResult = $modulePaths; foreach ($modulePathsResult as $moduleName => $modulePath) { - // Remove module if it is in blacklist - if (in_array($moduleName, $this->getModuleBlacklist())) { + // Remove module if it is in blocklist + if (in_array($moduleName, $this->getModuleBlocklist())) { unset($modulePathsResult[$moduleName]); LoggingUtil::getInstance()->getLogger(ModuleResolver::class)->info( "excluding module", @@ -754,13 +754,13 @@ private function getCustomModulePaths() } /** - * Getter for moduleBlacklist. + * Getter for moduleBlocklist. * * @return string[] */ - private function getModuleBlacklist() + private function getModuleBlocklist() { - return $this->moduleBlacklist; + return $this->moduleBlocklist; } /** diff --git a/src/Magento/FunctionalTestingFramework/Util/Validation/NameValidationUtil.php b/src/Magento/FunctionalTestingFramework/Util/Validation/NameValidationUtil.php index eb8d615a2..cf9f34164 100644 --- a/src/Magento/FunctionalTestingFramework/Util/Validation/NameValidationUtil.php +++ b/src/Magento/FunctionalTestingFramework/Util/Validation/NameValidationUtil.php @@ -40,7 +40,7 @@ public function __construct() } /** - * Function which runs a validation against the blacklisted char defined in this class. Validation occurs to insure + * Function which runs a validation against the blocklisted char defined in this class. Validation occurs to insure * allure report does not error/future devOps builds do not error against illegal char. * * @param string $name