Skip to content

Commit fd2da03

Browse files
authored
Merge pull request #727 from magento/DataEntity
Fix an issue with extended data array entity
2 parents bb111d8 + a0e287e commit fd2da03

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"symfony/finder": "^5.0",
3333
"symfony/mime": "^5.0",
3434
"symfony/process": "^4.4",
35-
"vlucas/phpdotenv": "^2.4"
35+
"vlucas/phpdotenv": "^2.4",
36+
"weew/helpers-array": "^1.3"
3637
},
3738
"require-dev": {
3839
"brainmaestro/composer-git-hooks": "^2.3.1",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/functional/tests/MFTF/DevDocs/Data/MessageData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@
1717
<item name="three">3</item>
1818
</array>
1919
</entity>
20+
21+
<entity name="ExtendedMessageData" extends="MessageData">
22+
<array key="numbers">
23+
<item name="TESTING CASE">TESTING CASE</item>
24+
</array>
25+
</entity>
2026
</entities>

dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
</actionGroup>
4949

5050
<assertEqualsCanonicalizing stepKey="assertMergedArray">
51-
<actualResult type="array">{{MessageData.numbers}}</actualResult>
52-
<expectedResult type="array">["Something New", "0", "1", "2", "3"]</expectedResult>
51+
<actualResult type="array">{{ExtendedMessageData.numbers}}</actualResult>
52+
<expectedResult type="array">["Something New", "0", "1", "2", "3", "TESTING CASE"]</expectedResult>
5353
</assertEqualsCanonicalizing>
5454
</test>
5555
</tests>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ private function processParserOutput($parserOutput)
226226
private function processArray($arrayItems, $data, $key)
227227
{
228228
$items = [];
229-
foreach ($arrayItems as $item) {
230-
$items[] = $item[self::_VALUE];
229+
foreach ($arrayItems as $key => $item) {
230+
$items[$key] = $item[self::_VALUE];
231231
}
232232

233233
return array_merge($items, $data[$key] ?? []);

src/Magento/FunctionalTestingFramework/DataGenerator/Util/DataExtensionUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function extendEntity($entityObject)
6262

6363
// Get all data for both parent and child and merge
6464
$referencedData = $parentEntity->getAllData();
65-
$newData = array_merge($referencedData, $entityObject->getAllData());
65+
$newData = array_extend($referencedData, $entityObject->getAllData());
6666

6767
// Get all linked references for both parent and child and merge
6868
$referencedLinks = $parentEntity->getLinkedEntities();

0 commit comments

Comments
 (0)