60 foreach ($testActions as $actionName => $actionData) {
64 if (empty($stepKey)) {
65 throw new XmlException(sprintf(self::STEP_KEY_EMPTY_ERROR_MSG, $actionData[
'nodeName']));
68 if (preg_match(
'/[^a-zA-Z0-9_]/', $stepKey)) {
69 throw new XmlException(sprintf(self::STEP_KEY_BLACKLIST_ERROR_MSG, $actionName));
74 self::TEST_STEP_MERGE_KEY,
79 if (isset($actionData[
"array"])) {
80 $actionAttributes[
'parameterArray'] = $actionData[
'array'][
'value'];
83 $actionAttributes = $this->processActionGroupArgs($actionType, $actionAttributes);
84 $linkedAction = $this->processLinkedActions($actionName, $actionData);
85 $actions = $this->extractFieldActions($actionData, $actions);
86 $actionAttributes = $this->extractFieldReferences($actionData, $actionAttributes);
88 if ($linkedAction[
'stepKey'] !=
null) {
89 $stepKeyRefs[$linkedAction[
'stepKey']][] = $stepKey;
101 $linkedAction[
'stepKey'],
102 $linkedAction[
'order']
106 $this->auditMergeSteps($stepKeyRefs, $testName);
120 private function processLinkedActions($actionName, $actionData)
122 $linkedAction =[
'stepKey' =>
null,
'order' =>
null];
123 if (array_key_exists(self::TEST_ACTION_BEFORE, $actionData)
124 and array_key_exists(self::TEST_ACTION_AFTER, $actionData)) {
125 throw new XmlException(sprintf(self::BEFORE_AFTER_ERROR_MSG, $actionName));
128 if (array_key_exists(self::TEST_ACTION_BEFORE, $actionData)) {
131 }
elseif (array_key_exists(self::TEST_ACTION_AFTER, $actionData)) {
136 return $linkedAction;
147 private function processActionGroupArgs($actionType, $actionAttributeData)
149 if ($actionType !== self::ACTION_GROUP_TAG) {
150 return $actionAttributeData;
153 $actionAttributeArgData = [];
154 foreach ($actionAttributeData as $attributeDataKey => $attributeDataValues) {
155 if ($attributeDataKey == self::ACTION_GROUP_REF) {
164 return $actionAttributeArgData;
178 private function extractFieldActions($actionData, $actions)
180 if (!in_array($actionData[self::NODE_NAME], self::DATA_PERSISTENCE_ACTIONS)) {
187 if (!is_array(
$data) ||
$data[self::NODE_NAME] != self::DATA_PERSISTENCE_CUSTOM_FIELD) {
194 . ucfirst($fieldData[self::DATA_PERSISTENCE_CUSTOM_FIELD_KEY]);
196 $fieldActions[] = $fieldData;
200 return array_merge($actions, $this->
extractActions($fieldActions));
212 private function extractFieldReferences($actionData, $actionAttributes)
214 if (!in_array($actionData[self::NODE_NAME], self::DATA_PERSISTENCE_ACTIONS)) {
215 return $actionAttributes;
219 foreach ($actionAttributes as $attributeName => $attributeValue) {
220 if (!is_array($attributeValue) || $attributeValue[self::NODE_NAME] != self::DATA_PERSISTENCE_CUSTOM_FIELD) {
228 if (array_key_exists(self::ACTION_OBJECT_PERSISTENCE_FIELDS,
$attributes)) {
243 private function auditMergeSteps($stepKeyRefs, $testName)
245 if (empty($stepKeyRefs)) {
250 $invalidStepRef = array_filter($stepKeyRefs,
function (
$value, $key) {
251 return in_array($key,
$value);
252 }, ARRAY_FILTER_USE_BOTH);
254 if (!empty($invalidStepRef)) {
255 throw new TestReferenceException(
256 "Invalid ordering configuration in test",
257 [
'test' => $testName,
'stepKey' => array_keys($invalidStepRef)]
262 $atRiskStepRef = array_filter($stepKeyRefs,
function (
$value) {
266 foreach ($atRiskStepRef as $stepKey => $stepRefs) {
268 'multiple actions referencing step key',
269 [
'test' => $testName,
'stepKey' => $stepKey,
'ref' => $stepRefs]
elseif(isset( $params[ 'redirect_parent']))