Skip to content

Commit 28f2979

Browse files
committed
ACQE-5089
Fix static issues
1 parent 09a1ec1 commit 28f2979

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,10 @@ public function execute(InputInterface $input)
115115

116116
// Build array of entities found in allow-list files
117117
// Expect one entity per file line, no commas or anything else
118-
foreach ($allModules as $modulePath)
119-
{
118+
foreach ($allModules as $modulePath) {
120119
if (file_exists($modulePath . DIRECTORY_SEPARATOR . self::ALLOW_LIST_FILENAME)) {
121120
$contents = file_get_contents($modulePath . DIRECTORY_SEPARATOR . self::ALLOW_LIST_FILENAME);
122-
foreach(explode("\n", $contents) as $entity) {
121+
foreach (explode("\n", $contents) as $entity) {
123122
$this->allowFailureEntities[$entity] = true;
124123
}
125124
}
@@ -150,7 +149,6 @@ public function execute(InputInterface $input)
150149
$this->errors += $this->findErrorsInFileSet($actionGroupXmlFiles);
151150
$this->errors += $this->findErrorsInFileSet($dataXmlFiles);
152151

153-
154152
// hold on to the output and print any errors to a file
155153
$this->output = $this->scriptUtil->printErrorsToFile(
156154
$this->errors,
@@ -159,10 +157,10 @@ public function execute(InputInterface $input)
159157
);
160158
if (!empty($this->warnings)) {
161159
$this->output .= "\n " . $this->scriptUtil->printWarningsToFile(
162-
$this->warnings,
163-
StaticChecksList::getErrorFilesPath() . DIRECTORY_SEPARATOR . self::WARNING_LOG_FILENAME . '.txt',
164-
self::ERROR_LOG_MESSAGE
165-
);
160+
$this->warnings,
161+
StaticChecksList::getErrorFilesPath() . DIRECTORY_SEPARATOR . self::WARNING_LOG_FILENAME . '.txt',
162+
self::ERROR_LOG_MESSAGE
163+
);
166164
}
167165
}
168166

src/Magento/FunctionalTestingFramework/Util/Script/ScriptUtil.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,38 @@ public function printErrorsToFile(array $errors, string $filePath, string $messa
6767
return $message . ": No errors found.";
6868
}
6969

70-
$this->printTofile($errors, $filePath, $message);
70+
$this->printTofile($errors, $filePath);
7171

7272
$errorCount = count($errors);
7373

7474
return $message . ": Errors found across {$errorCount} file(s). Error details output to {$filePath}";
7575
}
7676

77+
/**
78+
* Prints out given warnings to file, and returns summary result string
79+
* @param array $warnings
80+
* @param string $filePath
81+
* @param string $message
82+
* @return string
83+
*/
7784
public function printWarningsToFile(array $warnings, string $filePath, string $message): string
7885
{
7986
if (empty($warnings)) {
80-
return "" . ": No warnings found.";
87+
return $message . ": No warnings found.";
8188
}
82-
$this->printTofile($warnings, $filePath, $message);
89+
$this->printTofile($warnings, $filePath);
8390
$errorCount = count($warnings);
8491

8592
return $message . ": Warnings found across {$errorCount} file(s). Warning details output to {$filePath}";
8693
}
8794

88-
private function printTofile($contents, string $filePath, string $message)
95+
/**
96+
* Writes contents to filePath
97+
* @param array $contents
98+
* @param string $filePath
99+
* @return void
100+
*/
101+
private function printTofile(array $contents, string $filePath)
89102
{
90103
$dirname = dirname($filePath);
91104
if (!file_exists($dirname)) {

0 commit comments

Comments
 (0)