Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down