Skip to content

Commit 3e86d4f

Browse files
committed
MFTF deprecation notice attributes
- fix review comments
1 parent 6ff290a commit 3e86d4f

File tree

9 files changed

+20
-22
lines changed

9 files changed

+20
-22
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private function processParserOutput($parserOutput)
166166
$parentEntity = $rawEntity[self::_EXTENDS];
167167
}
168168

169-
if (array_key_exists('deprecated', $rawEntity)) {
170-
$deprecated = $rawEntity['deprecated'];
169+
if (array_key_exists(self::OBJ_DEPRECATED, $rawEntity)) {
170+
$deprecated = $rawEntity[self::OBJ_DEPRECATED];
171171
LoggingUtil::getInstance()->getLogger(self::class)->deprecation(
172172
$deprecated,
173173
["dataName" => $filename, "deprecatedEntity" => $deprecated]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private function initialize()
144144
$auth = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH] ?? null;
145145
$successRegex = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_SUCCESS_REGEX] ?? null;
146146
$returnRegex = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_RETURN_REGEX] ?? null;
147-
$deprecated = $opDefArray['deprecated'] ?? null;
147+
$deprecated = $opDefArray[ObjectHandlerInterface::OBJ_DEPRECATED] ?? null;
148148
$returnIndex = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_RETURN_INDEX] ?? 0;
149149
$contentType = $opDefArray[OperationDefinitionObjectHandler::ENTITY_OPERATION_CONTENT_TYPE][0]['value']
150150
?? null;

src/Magento/FunctionalTestingFramework/ObjectManager/ObjectHandlerInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
interface ObjectHandlerInterface
1313
{
14+
const OBJ_DEPRECATED = 'deprecated';
15+
1416
/**
1517
* Function to enforce singleton design pattern
1618
*

src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private function __construct()
6969
$sectionNames = array_keys($pageData[self::SECTION] ?? []);
7070
$parameterized = $pageData[self::PARAMETERIZED] ?? false;
7171
$filename = $pageData[self::FILENAME] ?? null;
72-
$deprecated = $pageData['deprecated'] ?? null;
72+
$deprecated = $pageData[self::OBJ_DEPRECATED] ?? null;
7373

7474
if ($deprecated !== null) {
7575
LoggingUtil::getInstance()->getLogger(self::class)->deprecation(

src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function __construct()
7575
$elementLocatorFunc = $elementData[SectionObjectHandler::LOCATOR_FUNCTION] ?? null;
7676
$elementTimeout = $elementData[SectionObjectHandler::TIMEOUT] ?? null;
7777
$elementParameterized = $elementData[SectionObjectHandler::PARAMETERIZED] ?? false;
78-
$elementDeprecated = $elementData['deprecated'] ?? null;
78+
$elementDeprecated = $elementData[self::OBJ_DEPRECATED] ?? null;
7979
if ($elementDeprecated !== null) {
8080
LoggingUtil::getInstance()->getLogger(ElementObject::class)->deprecation(
8181
$elementDeprecated,
@@ -97,7 +97,7 @@ private function __construct()
9797
}
9898

9999
$filename = $sectionData[self::FILENAME] ?? null;
100-
$sectionDeprecated = $sectionData['deprecated'] ?? null;
100+
$sectionDeprecated = $sectionData[self::OBJ_DEPRECATED] ?? null;
101101

102102
if ($sectionDeprecated !== null) {
103103
LoggingUtil::getInstance()->getLogger(ElementObject::class)->deprecation(

src/Magento/FunctionalTestingFramework/Test/Util/ActionGroupObjectExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function extractActionGroup($actionGroupData)
6262
$arguments = [];
6363
$deprecated = null;
6464

65-
if (array_key_exists('deprecated', $actionGroupData)) {
66-
$deprecated = $actionGroupData['deprecated'];
65+
if (array_key_exists(self::OBJ_DEPRECATED, $actionGroupData)) {
66+
$deprecated = $actionGroupData[self::OBJ_DEPRECATED];
6767
LoggingUtil::getInstance()->getLogger(ActionGroupObject::class)->deprecation(
6868
$deprecated,
6969
["actionGroupName" => $actionGroupData[self::FILENAME], "deprecatedActionGroup" => $deprecated]

src/Magento/FunctionalTestingFramework/Test/Util/BaseObjectExtractor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class BaseObjectExtractor
1313
{
1414
const NODE_NAME = 'nodeName';
1515
const NAME = 'name';
16+
const OBJ_DEPRECATED = 'deprecated';
1617

1718
/**
1819
* BaseObjectExtractor constructor.

src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
class TestObjectExtractor extends BaseObjectExtractor
2323
{
2424
const TEST_ANNOTATIONS = 'annotations';
25-
const TEST_DEPRECATED = 'deprecated';
2625
const TEST_BEFORE_HOOK = 'before';
2726
const TEST_AFTER_HOOK = 'after';
2827
const TEST_FAILED_HOOK = 'failed';
@@ -100,7 +99,7 @@ public function extractTestData($testData)
10099
$baseFileName = $fileNames[0];
101100
$module = $this->modulePathExtractor->extractModuleName($baseFileName);
102101
$testReference = $testData['extends'] ?? null;
103-
$deprecated = isset($testData[self::TEST_DEPRECATED]) ? $testData[self::TEST_DEPRECATED] : null;
102+
$deprecated = isset($testData[self::OBJ_DEPRECATED]) ? $testData[self::OBJ_DEPRECATED] : null;
104103
$testActions = $this->stripDescriptorTags(
105104
$testData,
106105
self::NODE_NAME,
@@ -112,7 +111,7 @@ public function extractTestData($testData)
112111
self::TEST_INSERT_BEFORE,
113112
self::TEST_INSERT_AFTER,
114113
self::TEST_FILENAME,
115-
self::TEST_DEPRECATED,
114+
self::OBJ_DEPRECATED,
116115
'extends'
117116
);
118117

@@ -134,9 +133,9 @@ public function extractTestData($testData)
134133
}
135134
$testAnnotations["description"]['test_files'] = $this->appendFileNamesInDescriptionAnnotation($fileNames);
136135

137-
$testAnnotations["description"][self::TEST_DEPRECATED] = [];
136+
$testAnnotations["description"][self::OBJ_DEPRECATED] = [];
138137
if ($deprecated !== null) {
139-
$testAnnotations["description"][self::TEST_DEPRECATED][] = $deprecated;
138+
$testAnnotations["description"][self::OBJ_DEPRECATED][] = $deprecated;
140139
LoggingUtil::getInstance()->getLogger(TestObject::class)->deprecation(
141140
$deprecated,
142141
["testName" => $filename, "deprecatedTest" => $deprecated]
@@ -166,8 +165,8 @@ public function extractTestData($testData)
166165
);
167166
}
168167

169-
if (!empty($testData[self::TEST_DEPRECATED])) {
170-
$testAnnotations[self::TEST_DEPRECATED] = $testData[self::TEST_DEPRECATED];
168+
if (!empty($testData[self::OBJ_DEPRECATED])) {
169+
$testAnnotations[self::OBJ_DEPRECATED] = $testData[self::OBJ_DEPRECATED];
171170
}
172171

173172
// TODO extract filename info and store

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\FunctionalTestingFramework\Util;
88

99
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
10-
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
1110
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
1211
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
1312
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
@@ -17,14 +16,11 @@
1716
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
1817
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
1918
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
20-
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
2119
use Magento\FunctionalTestingFramework\Test\Objects\TestHookObject;
2220
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
23-
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
21+
use Magento\FunctionalTestingFramework\Test\Util\BaseObjectExtractor;
2422
use Magento\FunctionalTestingFramework\Util\Manifest\BaseTestManifest;
25-
use Magento\FunctionalTestingFramework\Util\Manifest\TestManifestFactory;
2623
use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor;
27-
use Magento\FunctionalTestingFramework\Test\Util\TestObjectExtractor;
2824
use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil;
2925
use Magento\FunctionalTestingFramework\Test\Util\ActionMergeUtil;
3026
use Magento\FunctionalTestingFramework\Util\Path\FilePathFormatter;
@@ -510,9 +506,9 @@ private function generateDescriptionAnnotation(array $descriptions)
510506
$descriptionText = "";
511507

512508
$descriptionText .= $descriptions["main"] ?? '';
513-
if (!empty($descriptions[TestObjectExtractor::TEST_DEPRECATED]) || !empty($this->deprecationMessages)) {
509+
if (!empty($descriptions[BaseObjectExtractor::OBJ_DEPRECATED]) || !empty($this->deprecationMessages)) {
514510
$deprecatedMessages = array_merge(
515-
$descriptions[TestObjectExtractor::TEST_DEPRECATED],
511+
$descriptions[BaseObjectExtractor::OBJ_DEPRECATED],
516512
$this->deprecationMessages
517513
);
518514

0 commit comments

Comments
 (0)