diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php index 98646d0c4..b5aa8c4b1 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php @@ -255,6 +255,36 @@ public function testResolveDataInUserInput() $this->assertEquals($expected, $actionObject->getCustomActionAttributes()); } + /** + * {{EntityDataObject.values}} should be replaced with ["value1","value2"] + */ + public function testResolveArrayData() + { + // Set up mocks + $actionObject = new ActionObject('merge123', 'fillField', [ + 'selector' => '#selector', + 'userInput' => '{{EntityDataObject.values}}' + ]); + $entityDataObject = new EntityDataObject('EntityDataObject', 'test', [ + 'values' => [ + 'value1', + 'value2', + '"My" Value' + ] + ], [], '', ''); + $this->mockDataHandlerWithData($entityDataObject); + + // Call the method under test + $actionObject->resolveReferences(); + + // Verify + $expected = [ + 'selector' => '#selector', + 'userInput' => '["value1","value2","\"My\" Value"]' + ]; + $this->assertEquals($expected, $actionObject->getCustomActionAttributes()); + } + /** * Action object should throw an exception if a reference to a parameterized selector has too few given args. */ diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index ad062dbed..8a57013b1 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -495,6 +495,10 @@ private function findAndReplaceReferences($objectHandler, $inputString) $this->setTimeout($obj->getElement($objField)->getTimeout()); } elseif (get_class($obj) == EntityDataObject::class) { $replacement = $this->resolveEntityDataObjectReference($obj, $match); + + if (is_array($replacement)) { + $replacement = '["' . implode('","', array_map('addSlashes', $replacement)) . '"]'; + } } if ($replacement === null) {