|
7 | 7 |
|
8 | 8 | use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
|
9 | 9 | use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
|
| 10 | +use Magento\FunctionalTestingFramework\Exceptions\XmlException; |
10 | 11 | use Magento\FunctionalTestingFramework\ObjectManager\ObjectHandlerInterface;
|
11 | 12 | use Magento\FunctionalTestingFramework\Page\Objects\PageObject;
|
12 | 13 | use Magento\FunctionalTestingFramework\Page\Objects\SectionObject;
|
@@ -34,6 +35,7 @@ class ActionObject
|
34 | 35 | const ASSERTION_ATTRIBUTES = ["expectedResult" => "expected", "actualResult" => "actual"];
|
35 | 36 | const ASSERTION_TYPE_ATTRIBUTE = "type";
|
36 | 37 | const ASSERTION_VALUE_ATTRIBUTE = "value";
|
| 38 | + const DELETE_DATA_MUTUAL_EXCLUSIVE_ATTRIBUTES = ["url", "createDataKey"]; |
37 | 39 | const EXTERNAL_URL_AREA_INVALID_ACTIONS = ['amOnPage'];
|
38 | 40 | const MERGE_ACTION_ORDER_AFTER = 'after';
|
39 | 41 | const MERGE_ACTION_ORDER_BEFORE = 'before';
|
@@ -229,6 +231,9 @@ public function resolveReferences()
|
229 | 231 | $this->resolveSelectorReferenceAndTimeout();
|
230 | 232 | $this->resolveUrlReference();
|
231 | 233 | $this->resolveDataInputReferences();
|
| 234 | + if ($this->getType() == "deleteData") { |
| 235 | + $this->validateMutuallyExclusiveAttributes(self::DELETE_DATA_MUTUAL_EXCLUSIVE_ATTRIBUTES); |
| 236 | + } |
232 | 237 | }
|
233 | 238 | }
|
234 | 239 |
|
@@ -496,6 +501,28 @@ private function findAndReplaceReferences($objectHandler, $inputString)
|
496 | 501 | return $outputString;
|
497 | 502 | }
|
498 | 503 |
|
| 504 | + /** |
| 505 | + * Validates that the mutually exclusive attributes passed in don't all occur. |
| 506 | + * @param array $attributes |
| 507 | + * @return void |
| 508 | + * @throws TestReferenceException |
| 509 | + */ |
| 510 | + private function validateMutuallyExclusiveAttributes(array $attributes) |
| 511 | + { |
| 512 | + $matches = array_intersect($attributes, array_keys($this->getCustomActionAttributes())); |
| 513 | + if (count($matches) > 1) { |
| 514 | + throw new TestReferenceException( |
| 515 | + "Actions of type '{$this->getType()}' must only contain one attribute of types '" |
| 516 | + . implode("', '", $attributes) . "'" |
| 517 | + ); |
| 518 | + } elseif (count($matches) == 0) { |
| 519 | + throw new TestReferenceException( |
| 520 | + "Actions of type '{$this->getType()}' must contain at least one attribute of types '" |
| 521 | + . implode("', '", $attributes) . "'" |
| 522 | + ); |
| 523 | + } |
| 524 | + } |
| 525 | + |
499 | 526 | /**
|
500 | 527 | * Validates the page objects area 'external' against a list of known incompatible types
|
501 | 528 | *
|
|
0 commit comments