Skip to content

Commit d3ad955

Browse files
committed
Added slash escapement and moved condition for array entity arguments
1 parent 00b21e3 commit d3ad955

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ public function testResolveArrayData()
268268
$entityDataObject = new EntityDataObject('EntityDataObject', 'test', [
269269
'values' => [
270270
'value1',
271-
'value2'
271+
'value2',
272+
'"My" Value'
272273
]
273274
], [], '', '');
274275
$this->mockDataHandlerWithData($entityDataObject);
@@ -279,7 +280,7 @@ public function testResolveArrayData()
279280
// Verify
280281
$expected = [
281282
'selector' => '#selector',
282-
'userInput' => '["value1","value2"]'
283+
'userInput' => '["value1","value2","\"My\" Value"]'
283284
];
284285
$this->assertEquals($expected, $actionObject->getCustomActionAttributes());
285286
}

src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,12 @@ private function findAndReplaceReferences($objectHandler, $inputString)
493493
throw new TestReferenceException("Could not resolve entity reference " . $inputString);
494494
}
495495
}
496+
elseif (is_array($replacement)) {
497+
$replacement = '["' . implode('","', array_map('addSlashes',$replacement)) . '"]';
498+
}
496499

497500
$replacement = $this->resolveParameterization($parameterized, $replacement, $match, $obj);
498501

499-
if (is_array($replacement)) {
500-
$replacement = '["' . implode('","', $replacement) . '"]';
501-
}
502-
503502
$outputString = str_replace($match, $replacement, $outputString);
504503
}
505504
return $outputString;

0 commit comments

Comments
 (0)