Skip to content

Commit 272fb1e

Browse files
committed
- Fix assignment of correct value for object return property
- Fix operation method receive
1 parent 6a7a8d8 commit 272fb1e

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/AdminExecutor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ public function read($successRegex = null, $returnRegex = null)
158158
if (!empty($returnRegex)) {
159159
preg_match($returnRegex, $this->response, $returnMatches);
160160
if (!empty($returnMatches)) {
161-
return $returnMatches;
161+
if (count($returnMatches) > 1) {
162+
unset($returnMatches);
163+
}
164+
return reset($returnMatches);
162165
}
163166
}
164167
return $this->response;

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/FrontendExecutor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ public function read($successRegex = null, $returnRegex = null)
179179
if (!empty($returnRegex)) {
180180
preg_match($returnRegex, $this->response, $returnMatches);
181181
if (!empty($returnMatches)) {
182-
return $returnMatches;
182+
if (count($returnMatches) > 1) {
183+
unset($returnMatches);
184+
}
185+
return reset($returnMatches);
183186
}
184187
}
185188
return $this->response;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public function executeRequest($dependentEntities)
119119
$contentType = $this->operationDefinition->getContentType();
120120
$successRegex = $this->operationDefinition->getSuccessRegex();
121121
$returnRegex = $this->operationDefinition->getReturnRegex();
122+
$method = $this->operationDefinition->getApiMethod();
122123

123124
$operationDataResolver = new OperationDataArrayResolver($dependentEntities);
124125
$this->requestData = $operationDataResolver->resolveOperationDataArray(
@@ -156,7 +157,7 @@ public function executeRequest($dependentEntities)
156157
$executor->write(
157158
$apiUrl,
158159
$this->requestData,
159-
self::$curlMethodMapping[$this->operation],
160+
$method ?? self::$curlMethodMapping[$this->operation],
160161
$headers
161162
);
162163

src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<xs:attribute type="xs:string" name="url"/>
2727
<xs:attribute type="authEnum" name="auth"/>
2828
<xs:attribute type="xs:boolean" name="removeBackend" use="optional" default="true"/>
29-
<xs:attribute type="xs:string" name="method"/>
29+
<xs:attribute type="operationMethodEnum" name="method"/>
3030
<xs:attribute type="xs:string" name="successRegex"/>
3131
<xs:attribute type="xs:string" name="returnRegex"/>
3232
<xs:attribute type="xs:string" name="filename"/>
@@ -93,4 +93,12 @@
9393
<xs:enumeration value="anonymous" />
9494
</xs:restriction>
9595
</xs:simpleType>
96+
<xs:simpleType name="operationMethodEnum" final="restriction" >
97+
<xs:restriction base="xs:string">
98+
<xs:enumeration value="GET" />
99+
<xs:enumeration value="PUT" />
100+
<xs:enumeration value="POST" />
101+
<xs:enumeration value="DELETE" />
102+
</xs:restriction>
103+
</xs:simpleType>
96104
</xs:schema>

0 commit comments

Comments
 (0)