Skip to content

Commit a9ba447

Browse files
Manjusha.SManjusha.S
authored andcommitted
MQE-1677 : Static check for created data outside action group
1 parent 902fa7d commit a9ba447

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/CreatedDataFromOutsideActionGroupCheck.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CreatedDataFromOutsideActionGroupCheck implements StaticCheckInterface
3737
{
3838
const ACTIONGROUP_REGEX_PATTERN = '/\$(\$)*([\w.]+)(\$)*\$/';
3939
const ERROR_LOG_FILENAME = 'create-data-from-outside-action-group';
40-
const ERROR_LOG_MESSAGE = 'Created Data From Outside Action Group';
40+
const ERROR_MESSAGE = 'Created Data From Outside Action Group';
4141

4242
/**
4343
* Array containing all errors found after running the execute() function
@@ -60,13 +60,6 @@ class CreatedDataFromOutsideActionGroupCheck implements StaticCheckInterface
6060
*/
6161
private $scriptUtil;
6262

63-
/**
64-
* Action group xml files to scan
65-
*
66-
* @var Finder|array
67-
*/
68-
private $actionGroupXmlFiles = [];
69-
7063
/**
7164
* Checks test dependencies, determined by references in tests versus the dependencies listed in the Magento module
7265
*
@@ -79,11 +72,12 @@ public function execute(InputInterface $input)
7972
$this->scriptUtil = new ScriptUtil();
8073
$this->loadAllXmlFiles($input);
8174
$this->errors = [];
82-
$this->errors += $this->findReferenceErrorsInActionFiles($this->actionGroupXmlFiles);
75+
$this->errors += $this->findReferenceErrorsInActionFiles($this->actionGroupXmlFile);
76+
// hold on to the output and print any errors to a file
8377
$this->output = $this->scriptUtil->printErrorsToFile(
8478
$this->errors,
8579
StaticChecksList::getErrorFilesPath() . DIRECTORY_SEPARATOR . self::ERROR_LOG_FILENAME . '.txt',
86-
self::ERROR_LOG_MESSAGE
80+
self::ERROR_MESSAGE
8781
);
8882
}
8983

@@ -118,7 +112,6 @@ public function getOutput()
118112
private function loadAllXmlFiles($input)
119113
{
120114
$modulePaths = [];
121-
$includeRootPath = true;
122115
$path = $input->getOption('path');
123116
if ($path) {
124117
if (!realpath($path)) {
@@ -132,15 +125,14 @@ private function loadAllXmlFiles($input)
132125
true
133126
);
134127
$modulePaths[] = realpath($path);
135-
$includeRootPath = false;
136128
} else {
137129
$modulePaths = $this->scriptUtil->getAllModulePaths();
138130
}
139131

140132
// These files can contain references to other entities
141-
$this->actionGroupXmlFiles = $this->scriptUtil->getModuleXmlFilesByScope($modulePaths, 'ActionGroup');
133+
$this->actionGroupXmlFile = $this->scriptUtil->getModuleXmlFilesByScope($modulePaths, 'ActionGroup');
142134

143-
if (empty($this->actionGroupXmlFiles)) {
135+
if (empty($this->actionGroupXmlFile)) {
144136
if ($path) {
145137
throw new InvalidArgumentException(
146138
'Invalid --path option: '

0 commit comments

Comments
 (0)