Skip to content

Commit b4a7100

Browse files
committed
MQE-148: Add Code Sniffer static test to Acceptance Test Framework & Tests projects and run it in Jenkins
- fix cp detector
1 parent c78b9f3 commit b4a7100

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

src/Magento/AcceptanceTestFramework/Config/Converter/Dom/Flat.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ public function __construct(ArrayNodeConfig $arrayNodeConfig)
2929
$this->arrayNodeConfig = $arrayNodeConfig;
3030
}
3131

32+
/**
33+
* Retrieve key-value pairs of node attributes
34+
*
35+
* @param \DOMNode $node
36+
* @return array
37+
*/
38+
protected function getNodeAttributes(\DOMNode $node)
39+
{
40+
$result = [];
41+
$attributes = $node->attributes ?: [];
42+
/** @var \DOMNode $attribute */
43+
foreach ($attributes as $attribute) {
44+
if ($attribute->nodeType == XML_ATTRIBUTE_NODE) {
45+
$result[$attribute->nodeName] = $attribute->nodeValue;
46+
}
47+
}
48+
return $result;
49+
}
50+
3251
/**
3352
* Convert dom node tree to array in general case or to string in a case of a text node
3453
*
@@ -109,23 +128,4 @@ public function convert(\DOMNode $source, $basePath = '')
109128
}
110129
return $result;
111130
}
112-
113-
/**
114-
* Retrieve key-value pairs of node attributes
115-
*
116-
* @param \DOMNode $node
117-
* @return array
118-
*/
119-
protected function getNodeAttributes(\DOMNode $node)
120-
{
121-
$result = [];
122-
$attributes = $node->attributes ?: [];
123-
/** @var \DOMNode $attribute */
124-
foreach ($attributes as $attribute) {
125-
if ($attribute->nodeType == XML_ATTRIBUTE_NODE) {
126-
$result[$attribute->nodeName] = $attribute->nodeValue;
127-
}
128-
}
129-
return $result;
130-
}
131131
}

src/Magento/AcceptanceTestFramework/ObjectManager/Factory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ protected function parseArray(&$array)
224224
*/
225225
public function create($requestedType, array $arguments = [])
226226
{
227-
$type = $this->config->getInstanceType($requestedType);
228-
$parameters = $this->definitions->getParameters($type);
227+
$instanceType = $this->config->getInstanceType($requestedType);
228+
$parameters = $this->definitions->getParameters($instanceType);
229229
if ($parameters == null) {
230-
return new $type();
230+
return new $instanceType();
231231
}
232232
if (isset($this->creationStack[$requestedType])) {
233233
$lastFound = end($this->creationStack);
@@ -243,7 +243,7 @@ public function create($requestedType, array $arguments = [])
243243
throw $e;
244244
}
245245

246-
$reflection = new \ReflectionClass($type);
246+
$reflection = new \ReflectionClass($instanceType);
247247

248248
return $reflection->newInstanceArgs($args);
249249
}

src/Magento/AcceptanceTestFramework/ObjectManager/Factory/Dynamic/Developer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ protected function parseArray(&$array)
172172
* @throws \Exception
173173
*
174174
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
175+
* @SuppressWarnings(PHPCPD)
175176
*/
176177
public function create($requestedType, array $arguments = [])
177178
{

0 commit comments

Comments
 (0)