Skip to content

Commit f1e2b37

Browse files
committed
MQE-610:[PHPMD] Reduce Cyclomatic Complexity in Problem Methods
fixed as per review comments
1 parent 8c9b667 commit f1e2b37

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

src/Magento/FunctionalTestingFramework/Config/FileResolver/Module.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class Module implements FileResolverInterface
2626
* Module constructor.
2727
* @param ModuleResolver|null $moduleResolver
2828
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
29-
* @TODO ported magento code - to be refactored later
3029
*/
3130
public function __construct(ModuleResolver $moduleResolver = null)
3231
{

src/Magento/FunctionalTestingFramework/DataGenerator/Objects/EntityDataObject.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
1010
use Magento\FunctionalTestingFramework\DataGenerator\Util\GenerationDataReferenceResolver;
1111
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
12+
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
1213
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
1314

1415
/**
@@ -189,7 +190,7 @@ public function getDataByName($name, $uniquenessFormat)
189190
* @param integer $uniquenessFormat
190191
* @return string|null
191192
* @throws TestFrameworkException
192-
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
193+
* @throws TestReferenceException
193194
*/
194195
private function resolveDataReferences($name, $uniquenessFormat)
195196
{

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\FunctionalTestingFramework\DataGenerator\Util\OperationElementExtractor;
1414
use Magento\FunctionalTestingFramework\DataGenerator\Util\RuntimeDataReferenceResolver;
1515
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
16+
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
1617

1718
class OperationDataArrayResolver
1819
{
@@ -126,9 +127,9 @@ public function resolveOperationDataArray($entityObject, $operationMetadata, $op
126127
* Resolve data references at run time.
127128
* @param array $operationDataArray
128129
* @param EntityDataObject $entityObject
129-
* @return mixed
130+
* @return array
130131
* @throws TestFrameworkException
131-
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
132+
* @throws TestReferenceException
132133
*/
133134
private function resolveRunTimeDataReferences($operationDataArray, $entityObject)
134135
{

src/Magento/FunctionalTestingFramework/ObjectManager/Config/Config.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,19 @@ protected function mergeConfiguration(array $configuration)
207207
break;
208208

209209
default:
210-
$this->setArguments($key, $curConfig);
211-
break;
210+
$this->setConfiguration($key, $curConfig);
212211
}
213212
}
214213
}
215214

216215
/**
217-
* Set arguments
216+
* Set configuration
218217
*
219218
* @param string $key
220219
* @param array $config
221220
* @return void
222221
*/
223-
private function setArguments($key, $config)
222+
private function setConfiguration($key, $config)
224223
{
225224
$key = ltrim($key, '\\');
226225
if (isset($config['type'])) {

src/Magento/FunctionalTestingFramework/ObjectManager/Config/Mapper/Dom.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ public function convert($config)
8080
$typeData['type'] = $attributeType->nodeValue;
8181
}
8282
}
83-
$typeArguments = $this->parseTypeArguments($node);
84-
$typeData['arguments'] = $typeArguments;
83+
$typeData['arguments'] = $this->setTypeArguments($node);
8584
$output[$typeNodeAttributes->getNamedItem('name')->nodeValue] = $typeData;
8685
break;
8786
default:
@@ -93,12 +92,14 @@ public function convert($config)
9392
}
9493

9594
/** Read typeChildNodes and set typeArguments
96-
* @param $node
95+
* @param DOMNode $node
9796
* @return mixed
9897
* @throws \Exception
9998
*/
100-
private function parseTypeArguments($node)
99+
private function setTypeArguments($node)
101100
{
101+
$typeArguments = [];
102+
102103
foreach ($node->childNodes as $typeChildNode) {
103104
/** @var \DOMNode $typeChildNode */
104105
if ($typeChildNode->nodeType != XML_ELEMENT_NODE) {
@@ -117,13 +118,14 @@ private function parseTypeArguments($node)
117118
$argumentData
118119
);
119120
}
120-
return $typeArguments;
121+
break;
121122

122123
default:
123124
throw new \Exception(
124125
"Invalid application config. Unknown node: {$typeChildNode->nodeName}."
125126
);
126127
}
127128
}
129+
return $typeArguments;
128130
}
129131
}

src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private function findErrorsInFileSet($files)
186186
$this->resolveEntityReferences($extendReferences[1]);
187187

188188
// Find violating references and set error output
189-
$violatingReferences = $this->findViolatingReferences($filePath);
189+
$violatingReferences = $this->findViolatingReferences($moduleFullName);
190190
$testErrors = $this->setErrorOutput($violatingReferences, $filePath);
191191
}
192192
return $testErrors;

0 commit comments

Comments
 (0)