Skip to content

Commit 15c26f9

Browse files
committed
MQE-765: Operation metadata does not have a notion of backend naming
- update OperationDefinitionObject to append backend name to auth type of adminFormkey - update OperationDefintiionObjectHandler to print deprecation warning to console when hardcoded backend name is detected
1 parent 1c3308d commit 15c26f9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/OperationDefinitionObjectHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class OperationDefinitionObjectHandler implements ObjectHandlerInterface
2121
const ENTITY_OPERATION_URL = 'url';
2222
const ENTITY_OPERATION_METHOD = 'method';
2323
const ENTITY_OPERATION_AUTH = 'auth';
24+
const ENTITY_OPERATION_URL_AREA = 'area';
2425
const ENTITY_OPERATION_STORE_CODE = 'storeCode';
2526
const ENTITY_OPERATION_SUCCESS_REGEX = 'successRegex';
2627
const ENTITY_OPERATION_RETURN_REGEX = 'returnRegex';
@@ -149,6 +150,13 @@ private function initialize()
149150
$params = [];
150151
$operationElements = [];
151152

153+
// TODO remove this warning with 2.1.0 release
154+
$backendName = getenv('MAGENTO_BACKEND_NAME');
155+
if ($auth == "adminFormKey" && substr($url, 1, strlen($backendName)) == $backendName) {
156+
print "\033[1;33mDEPRECATED: MFTF will now automatically append MAGENTO_BACKEND_NAME to adminFormKey " .
157+
"auth type operations by default, please update metadata: {$dataDefName}\033[0m\n";
158+
}
159+
152160
if (array_key_exists(OperationDefinitionObjectHandler::ENTITY_OPERATION_HEADER, $opDefArray)) {
153161
foreach ($opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_HEADER] as $headerEntry) {
154162
if (isset($headerEntry[OperationDefinitionObjectHandler::ENTITY_OPERATION_HEADER_VALUE])

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ public function getApiUrl()
201201
}
202202
}
203203

204+
// TODO remove this block of code as part of 2.1.0 release.
205+
// Checks existing urls to validate backend name is not hardcoded to url.
206+
$backendName = getenv('MAGENTO_BACKEND_NAME');
207+
if ($this->getAuth() == 'adminFormKey' && substr($this->apiUrl, 0, strlen($backendName)) != $backendName) {
208+
return "/{$backendName}/" . $this->apiUrl;
209+
}
210+
204211
return $this->apiUrl;
205212
}
206213

0 commit comments

Comments
 (0)