Skip to content

Commit 2a0a9e9

Browse files
committed
MQE-942: MFTF Annotation Static Check
1 parent 86e644a commit 2a0a9e9

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
1010
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
11+
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
1112
use Magento\FunctionalTestingFramework\Util\Script\ScriptUtil;
1213
use Symfony\Component\Console\Input\InputInterface;
1314
use Exception;
@@ -110,7 +111,8 @@ public function getOutput()
110111
* description
111112
* severity
112113
*
113-
* @param $test
114+
* @param TestObject $test
115+
* @return void
114116
*/
115117
private function validateRequiredAnnotations($test)
116118
{
@@ -146,7 +148,8 @@ private function validateRequiredAnnotations($test)
146148
/**
147149
* Add the key = "stories appended to title", value = test name, to the class variable.
148150
*
149-
* @param $test
151+
* @param TestObject $test
152+
* @return void
150153
*/
151154
private function aggregateStoriesTitlePairs($test)
152155
{
@@ -161,7 +164,8 @@ private function aggregateStoriesTitlePairs($test)
161164
/**
162165
* Add the key = "testCaseId appended to title", value = test name, to the class variable.
163166
*
164-
* @param $test
167+
* @param TestObject $test
168+
* @return void
165169
*/
166170
private function aggregateTestCaseIdTitlePairs($test)
167171
{
@@ -177,7 +181,7 @@ private function aggregateTestCaseIdTitlePairs($test)
177181
* Strip away the testCaseId prefix that was automatically added to the test title
178182
* so that way we have just the raw title from the XML file.
179183
*
180-
* @param $test
184+
* @param TestObject $test
181185
* @return string|null
182186
*/
183187
private function getTestTitleWithoutPrefix($test)
@@ -194,6 +198,8 @@ private function getTestTitleWithoutPrefix($test)
194198

195199
/**
196200
* Adds an error if any story+title pairs are used by more than one test.
201+
*
202+
* @return void
197203
*/
198204
private function validateStoriesTitlePairs()
199205
{
@@ -206,6 +212,8 @@ private function validateStoriesTitlePairs()
206212

207213
/**
208214
* Adds an error if any testCaseId+title pairs are used by more than one test.
215+
*
216+
* @return void
209217
*/
210218
private function validateTestCaseIdTitlePairs()
211219
{

src/Magento/FunctionalTestingFramework/Test/Util/ActionGroupAnnotationExtractor.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ class ActionGroupAnnotationExtractor extends AnnotationExtractor
1717
* This method trims away irrelevant tags and returns annotations used in the array passed. The annotations
1818
* can be found in both Tests and their child element tests.
1919
*
20-
* @param array $testAnnotations
21-
* @param string $filename
20+
* @param array $testAnnotations
21+
* @param string $filename
22+
* @param boolean $validateAnnotations
2223
* @return array
2324
* @throws \Exception
2425
*/
25-
public function extractAnnotations($testAnnotations, $filename)
26+
public function extractAnnotations($testAnnotations, $filename, $validateAnnotations = true)
2627
{
2728
$annotationObjects = [];
2829
$annotations = $this->stripDescriptorTags($testAnnotations, parent::NODE_NAME);

src/Magento/FunctionalTestingFramework/Test/Util/AnnotationExtractor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function __construct()
5959
* @param string $filename
6060
* @return array
6161
* @throws XmlException
62+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
6263
*/
6364
public function extractAnnotations($testAnnotations, $filename, $validateAnnotations = true)
6465
{

0 commit comments

Comments
 (0)