Skip to content

Commit 9505f04

Browse files
soumyaujilu1
andauthored
MQE-2138: Annotation static check incorrectly flags some extends test… (#713)
* MQE-2138: Annotation static check incorrectly flags some extends tests for missing issueIds * MQE-2138: annotation static check incorrectly flags some extends tests for missing issueIds Co-authored-by: Ji Lu <jilu1@adobe.com>
1 parent e2780f0 commit 9505f04

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ public function execute(InputInterface $input)
7070
$allTests = TestObjectHandler::getInstance(false)->getAllObjects();
7171

7272
foreach ($allTests as $test) {
73+
if ($this->validateSkipIssueId($test)) {
74+
//if test is skipped ignore other checks
75+
continue;
76+
}
7377
$this->validateRequiredAnnotations($test);
74-
$this->validateSkipIssueId($test);
7578
$this->aggregateStoriesTitlePairs($test);
7679
$this->aggregateTestCaseIdTitlePairs($test);
7780
}
@@ -150,19 +153,22 @@ private function validateRequiredAnnotations($test)
150153
* Validates that if the test is skipped, that it has an issueId value.
151154
*
152155
* @param TestObject $test
153-
* @return void
156+
* @return boolean
154157
*/
155158
private function validateSkipIssueId($test)
156159
{
160+
$validateSkipped = false;
157161
$annotations = $test->getAnnotations();
158162

159163
$skip = $annotations['skip'] ?? null;
160164
if ($skip !== null) {
161-
$issueId = $skip[0] ?? null;
162-
if ($issueId === null || strlen($issueId) == 0) {
165+
$validateSkipped = true;
166+
if ((!isset($skip[0]) || strlen($skip[0]) == 0)
167+
&& (!isset($skip['issueId']) || strlen($skip['issueId']) == 0)) {
163168
$this->errors[][] = "Test {$test->getName()} is skipped but the issueId is empty.";
164169
}
165170
}
171+
return $validateSkipped;
166172
}
167173

168174
/**

0 commit comments

Comments
 (0)