diff --git a/dev/tests/functional/tests/MFTF/DevDocs/Data/DeprecatedMessageData.xml b/dev/tests/functional/tests/MFTF/DevDocs/Data/DeprecatedMessageData.xml index 1c2462c2f..ba1460a60 100644 --- a/dev/tests/functional/tests/MFTF/DevDocs/Data/DeprecatedMessageData.xml +++ b/dev/tests/functional/tests/MFTF/DevDocs/Data/DeprecatedMessageData.xml @@ -11,4 +11,7 @@ Introduction to the Magento Functional Testing Framework + + Some data + diff --git a/dev/tests/functional/tests/MFTF/DevDocs/Data/ExtendMessageData.xml b/dev/tests/functional/tests/MFTF/DevDocs/Data/ExtendMessageData.xml new file mode 100644 index 000000000..040b80597 --- /dev/null +++ b/dev/tests/functional/tests/MFTF/DevDocs/Data/ExtendMessageData.xml @@ -0,0 +1,16 @@ + + + + + + + Something New + + + diff --git a/dev/tests/functional/tests/MFTF/DevDocs/Data/MessageData.xml b/dev/tests/functional/tests/MFTF/DevDocs/Data/MessageData.xml index 9c34b5672..2b9d3a520 100644 --- a/dev/tests/functional/tests/MFTF/DevDocs/Data/MessageData.xml +++ b/dev/tests/functional/tests/MFTF/DevDocs/Data/MessageData.xml @@ -10,5 +10,11 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> Introduction to the Magento Functional Testing Framework + + 0 + 1 + 2 + 3 + diff --git a/dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml b/dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml index 3470a2440..02d6481a8 100644 --- a/dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml +++ b/dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml @@ -46,5 +46,10 @@ + + + {{MessageData.numbers}} + ["Something New", "0", "1", "2", "3"] + diff --git a/docs/data.md b/docs/data.md index fa4c90dcf..8b0a86e3d 100644 --- a/docs/data.md +++ b/docs/data.md @@ -276,6 +276,11 @@ Attributes|Type|Use|Description `` is an individual piece of data to be passed in as part of the parent `` type. +Attributes|Type|Use|Description +---|---|---|--- +`name`|string|optional|Key attribute of entity in which to assign a value. By default numeric key will be generated. + + [``]: #array-tag [``]: #data-tag diff --git a/etc/di.xml b/etc/di.xml index 27dfc61c8..e561911da 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -157,6 +157,7 @@ name key + name type diff --git a/src/Magento/FunctionalTestingFramework/Config/Dom.php b/src/Magento/FunctionalTestingFramework/Config/Dom.php index 6d10811ca..881b677dc 100644 --- a/src/Magento/FunctionalTestingFramework/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/Config/Dom.php @@ -246,8 +246,8 @@ protected function getNodePathByParent(\DOMElement $node, $parentPath) $idAttribute = $this->nodeMergingConfig->getIdAttribute($path); if ($idAttribute) { foreach (explode('|', $idAttribute) as $idAttributeValue) { - if ($value = $node->getAttribute($idAttributeValue)) { - $path .= "[@{$idAttributeValue}='{$value}']"; + if ($node->hasAttribute($idAttributeValue)) { + $path .= "[@{$idAttributeValue}='" . $node->getAttribute($idAttributeValue) . "']"; break; } } diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Config/Dom.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Config/Dom.php index d4b8f7c8f..bc19c35aa 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Config/Dom.php @@ -81,6 +81,13 @@ public function initDom($xml, $filename = null) } } + $itemNodes = $dom->getElementsByTagName('item'); + /** @var \DOMElement $itemNode */ + foreach ($itemNodes as $itemKey => $itemNode) { + if ($itemNode->hasAttribute("name") == false) { + $itemNode->setAttribute("name", (string)$itemKey); + } + } return $dom; } } diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd b/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd index 9d0d8bb35..923f7c48f 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd @@ -118,17 +118,32 @@ - - - - Individual piece of data to be passed in as part of the parrent array type. - - + + + + Individual piece of data to be passed in as part of the parrent array type. + + + + + + + + + + Key attribute of item pair. + + + + + + +