Skip to content

Commit 64972b3

Browse files
authored
MQE-837: Assert sub-elements can't be declared out of sequence
- changed sequence -> choice in schema for assert actions. - added check for correct schema in actionObject, in lieu of schema validation due to backwards compatibility
1 parent 60fce89 commit 64972b3

File tree

2 files changed

+86
-70
lines changed

2 files changed

+86
-70
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,22 @@ public function trimAssertionAttributes()
239239
return;
240240
}
241241

242+
/** MQE-683 DEPRECATE OLD METHOD HERE
243+
* Unnecessary validation, only needed for backwards compatibility
244+
*/
245+
$singleChildTypes = ['assertEmpty', 'assertFalse', 'assertFileExists', 'assertFileNotExists',
246+
'assertIsEmpty', 'assertNotEmpty', 'assertNotNull', 'assertNull', 'assertTrue',
247+
'assertElementContainsAttribute'];
248+
249+
if (!in_array($this->type, $singleChildTypes)) {
250+
if (!in_array('expectedResult', $relevantAssertionAttributes)
251+
|| !in_array('actualResult', $relevantAssertionAttributes)) {
252+
// @codingStandardsIgnoreStart
253+
throw new TestReferenceException("{$this->type} must have both an expectedResult and actualResult defined (stepKey: {$this->stepKey})");
254+
// @codingStandardsIgnoreEnd
255+
}
256+
}
257+
242258
// Flatten nested Elements's type and value into key=>value entries
243259
foreach ($this->actionAttributes as $key => $subAttributes) {
244260
if (in_array($key, $relevantKeys)) {

0 commit comments

Comments
 (0)