Skip to content

Commit a1b7c6c

Browse files
committed
MQE-769: Deprecate warning and check around appending backend name to adminFormKey requests
- remove deprecated 2.0.3 code - fix issue with dulicate forward slash in url
1 parent daa890f commit a1b7c6c

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ private function initialize()
152152
$operationElements = [];
153153
$removeBackend = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_BACKEND_REMOVE] ?? false;
154154

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

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,6 @@ public function getApiUrl()
211211
}
212212
}
213213

214-
// TODO remove this block of code as part of 2.1.0 release.
215-
// Checks existing urls to validate backend name is not hardcoded to url.
216-
$backendName = getenv('MAGENTO_BACKEND_NAME');
217-
if ($this->getAuth() == 'adminFormKey' && substr($this->apiUrl, 0, strlen($backendName)) != $backendName) {
218-
return "/{$backendName}/" . $this->apiUrl;
219-
}
220-
221214
return $this->apiUrl;
222215
}
223216

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ private function setFormKey()
117117
*/
118118
public function write($url, $data = [], $method = CurlInterface::POST, $headers = [])
119119
{
120+
$url = ltrim($url, "/");
120121
$apiUrl = self::$adminUrl . $url;
121122

122123
if ($this->removeBackend) {
123-
$apiUrl = parent::$baseUrl . ltrim($url, '/');
124+
$apiUrl = parent::$baseUrl . $url;
124125
}
125126

126127
if ($this->formKey) {

0 commit comments

Comments
 (0)