10
10
use Magento \FunctionalTestingFramework \Exceptions \XmlException ;
11
11
use Magento \FunctionalTestingFramework \Page \Objects \SectionObject ;
12
12
use Magento \FunctionalTestingFramework \Test \Objects \ActionObject ;
13
- use Symfony \Component \Console \Exception \InvalidArgumentException ;
13
+ use Magento \FunctionalTestingFramework \Page \Objects \ElementObject ;
14
+ use Magento \FunctionalTestingFramework \Test \Objects \ActionGroupObject ;
15
+ use Magento \FunctionalTestingFramework \Page \Objects \PageObject ;
16
+ use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
14
17
use Symfony \Component \Console \Input \InputInterface ;
15
18
use Symfony \Component \Finder \Finder ;
16
19
use Exception ;
26
29
/**
27
30
* Class DeprecatedEntityUsageCheck
28
31
* @package Magento\FunctionalTestingFramework\StaticCheck
32
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
29
33
*/
30
34
class DeprecatedEntityUsageCheck implements StaticCheckInterface
31
35
{
@@ -68,7 +72,7 @@ class DeprecatedEntityUsageCheck implements StaticCheckInterface
68
72
*
69
73
* @param InputInterface $input
70
74
* @return string
71
- * @throws Exception;
75
+ * @throws Exception
72
76
*/
73
77
public function execute (InputInterface $ input )
74
78
{
@@ -79,7 +83,7 @@ public function execute(InputInterface $input)
79
83
$ path = $ input ->getOption ('path ' );
80
84
if ($ path ) {
81
85
if (!realpath ($ path )) {
82
- throw new InvalidArgumentException ( "Invalid --path option: " . $ path) ;
86
+ return "Invalid --path option: " . $ path ;
83
87
}
84
88
MftfApplicationConfig::create (
85
89
true ,
@@ -251,6 +255,7 @@ private function findReferenceErrorsInActionFiles($files)
251
255
*
252
256
* @param Finder $files
253
257
* @return array
258
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
254
259
*/
255
260
private function findReferenceErrorsInDataFiles ($ files )
256
261
{
@@ -329,7 +334,7 @@ private function twoDimensionArrayUnique($inArray)
329
334
* Return attribute value for each node in DOMNodeList as an array
330
335
*
331
336
* @param DOMNodeList $nodes
332
- * @param string $attributeName
337
+ * @param string $attributeName
333
338
* @return array
334
339
*/
335
340
private function getAttributesFromDOMNodeList ($ nodes , $ attributeName )
@@ -411,6 +416,8 @@ private function getMetadataFromData($references, $type)
411
416
*
412
417
* @param array $references
413
418
* @return array
419
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
420
+ * @SuppressWarnings(PHPMD.NPathComplexity)
414
421
*/
415
422
private function findViolatingMetadataReferences ($ references )
416
423
{
@@ -526,9 +533,9 @@ private function findViolatingReferences($references)
526
533
if ($ entity ->getDeprecated ()) {
527
534
$ classType = get_class ($ entity );
528
535
$ name = $ entity ->getName ();
529
- if ($ classType === ' Magento\FunctionalTestingFramework\Page\Objects\ ElementObject' ) {
536
+ if ($ classType === ElementObject::class ) {
530
537
$ name = $ key ;
531
- list ($ section , $ field ) = explode ('. ' , $ key , 2 );
538
+ list ($ section ,) = explode ('. ' , $ key , 2 );
532
539
/** @var SectionObject $references[$section] */
533
540
$ file = $ references [$ section ]->getFilename ();
534
541
} else {
@@ -578,19 +585,19 @@ private function setErrorOutput($violatingReferences, $path)
578
585
private function getSubjectFromClassType ($ classname )
579
586
{
580
587
$ subject = null ;
581
- if ($ classname === ' Magento\FunctionalTestingFramework\Test\Objects\ ActionGroupObject' ) {
588
+ if ($ classname === ActionGroupObject::class ) {
582
589
$ subject = 'Deprecated ActionGroup(s) ' ;
583
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\Test\Objects\ TestObject' ) {
590
+ } elseif ($ classname === TestObject::class ) {
584
591
$ subject = 'Deprecated Test(s) ' ;
585
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\Page\Objects\ SectionObject' ) {
592
+ } elseif ($ classname === SectionObject::class ) {
586
593
$ subject = 'Deprecated Section(s) ' ;
587
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\Page\Objects\ PageObject' ) {
594
+ } elseif ($ classname === PageObject::class ) {
588
595
$ subject = 'Deprecated Page(s) ' ;
589
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\Page\Objects\ ElementObject' ) {
596
+ } elseif ($ classname === ElementObject::class ) {
590
597
$ subject = 'Deprecated Element(s) ' ;
591
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\DataGenerator\Objects\ EntityDataObject' ) {
598
+ } elseif ($ classname === EntityDataObject::class ) {
592
599
$ subject = 'Deprecated Data(s) ' ;
593
- } elseif ($ classname === ' Magento\FunctionalTestingFramework\DataGenerator\Objects\ OperationDefinitionObject' ) {
600
+ } elseif ($ classname === OperationDefinitionObject::class ) {
594
601
$ subject = 'Deprecated Metadata(s) ' ;
595
602
}
596
603
return $ subject ;
0 commit comments