Skip to content

Commit 253f352

Browse files
committed
MQE-2229: Deprecation Error When Deprecated ActionGroup References Deprecated Element
1 parent 98d9a3b commit 253f352

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/DeprecatedEntityUsageCheck.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DeprecatedEntityUsageCheck implements StaticCheckInterface
3737
{
3838
const EXTENDS_REGEX_PATTERN = '/extends=["\']([^\'"]*)/';
3939
const ACTIONGROUP_REGEX_PATTERN = '/ref=["\']([^\'"]*)/';
40+
const DEPRECATED_REGEX_PATTERN = '/deprecated=["\']([^\'"]*)/';
4041

4142
const ERROR_LOG_FILENAME = 'mftf-deprecated-entity-usage-checks';
4243
const ERROR_LOG_MESSAGE = 'MFTF Deprecated Entity Usage Check';
@@ -225,6 +226,9 @@ private function findReferenceErrorsInActionFiles($files, $checkTestRef = false)
225226
/** @var SplFileInfo $filePath */
226227
foreach ($files as $filePath) {
227228
$contents = file_get_contents($filePath);
229+
if ($this->isDeprecated($contents)) {
230+
continue;
231+
}
228232
preg_match_all(ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN, $contents, $braceReferences);
229233
preg_match_all(self::ACTIONGROUP_REGEX_PATTERN, $contents, $actionGroupReferences);
230234
preg_match_all(self::EXTENDS_REGEX_PATTERN, $contents, $extendReferences);
@@ -316,6 +320,17 @@ private function findReferenceErrorsInActionFiles($files, $checkTestRef = false)
316320
return $testErrors;
317321
}
318322

323+
/**
324+
* Checks if entity is deprecated in action files.
325+
* @param string $contents
326+
* @return boolean
327+
*/
328+
private function isDeprecated($contents)
329+
{
330+
preg_match_all(self::DEPRECATED_REGEX_PATTERN, $contents, $deprecatedEntity);
331+
return (!empty($deprecatedEntity[1]));
332+
}
333+
319334
/**
320335
* Find reference errors in a set of data files
321336
*

0 commit comments

Comments
 (0)