File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
dev/tests/unit/Magento/FunctionalTestFramework/Test/Util
src/Magento/FunctionalTestingFramework/Test/Util Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,15 @@ public function testAmbiguousMergeOrderReference()
89
89
);
90
90
}
91
91
92
+ /**
93
+ * Tests basic action object extraction with an empty stepKey
94
+ */
95
+ public function testEmptyStepKey ()
96
+ {
97
+ $ this ->expectExceptionMessage ("StepKeys cannot be empty. Action='sampleAction' " );
98
+ $ this ->testActionObjectExtractor ->extractActions ($ this ->createBasicActionObjectArray ("" ));
99
+ }
100
+
92
101
/**
93
102
* Utility function to return mock parser output for testing extraction into ActionObjects.
94
103
*
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class ActionObjectExtractor extends BaseObjectExtractor
27
27
const ACTION_GROUP_ARG_VALUE = 'value ' ;
28
28
const BEFORE_AFTER_ERROR_MSG = "Merge Error - Steps cannot have both before and after attributes. \tStepKey='%s' " ;
29
29
const STEP_KEY_BLACKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters. \tStepKey='%s' " ;
30
+ const STEP_KEY_EMPTY_ERROR_MSG = "StepKeys cannot be empty. \tAction='%s' " ;
30
31
const DATA_PERSISTENCE_CUSTOM_FIELD = 'field ' ;
31
32
const DATA_PERSISTENCE_CUSTOM_FIELD_KEY = 'key ' ;
32
33
const ACTION_OBJECT_PERSISTENCE_FIELDS = 'customFields ' ;
@@ -59,6 +60,10 @@ public function extractActions($testActions, $testName = null)
59
60
foreach ($ testActions as $ actionName => $ actionData ) {
60
61
$ stepKey = $ actionData [self ::TEST_STEP_MERGE_KEY ];
61
62
63
+ if (empty ($ stepKey )) {
64
+ throw new XmlException (sprintf (self ::STEP_KEY_EMPTY_ERROR_MSG , $ actionData ['nodeName ' ]));
65
+ }
66
+
62
67
if (preg_match ('/[^a-zA-Z0-9_]/ ' , $ stepKey )) {
63
68
throw new XmlException (sprintf (self ::STEP_KEY_BLACKLIST_ERROR_MSG , $ actionName ));
64
69
}
You can’t perform that action at this time.
0 commit comments