16 private $testActionObjectExtractor;
30 public function testBasicActionObjectExtration()
32 $actionObjects = $this->testActionObjectExtractor->extractActions($this->createBasicActionObjectArray());
33 $this->assertCount(1, $actionObjects);
36 $firstElement = array_values($actionObjects)[0];
37 $this->assertEquals(
'testAction1', $firstElement->getStepKey());
38 $this->assertCount(1, $firstElement->getCustomActionAttributes());
46 $invalidArray = $this->createBasicActionObjectArray(
'invalidTestAction1',
'invalidTestAction1');
47 $this->expectException(\
Magento\FunctionalTestingFramework\Exceptions\TestReferenceException::class);
49 $this->testActionObjectExtractor->extractActions($invalidArray,
'TestWithSelfReferencingStepKey');
50 }
catch (\Exception $e) {
53 '/Line \d*: Invalid ordering configuration in test/',
55 'test' =>
'TestWithSelfReferencingStepKey',
56 'stepKey' => [
'invalidTestAction1']
69 $ambiguousArray = $this->createBasicActionObjectArray(
'testAction1');
70 $ambiguousArray = array_merge(
72 $this->createBasicActionObjectArray(
'testAction2',
'testAction1')
75 $ambiguousArray = array_merge(
77 $this->createBasicActionObjectArray(
'testAction3',
null,
'testAction1')
80 $this->testActionObjectExtractor->extractActions($ambiguousArray,
'AmbiguousRefTest');
83 'multiple actions referencing step key',
85 'test' =>
'AmbiguousRefTest',
86 'stepKey' =>
'testAction1',
87 'ref' => [
'testAction2',
'testAction3']
97 $this->expectExceptionMessage(
"StepKeys cannot be empty. Action='sampleAction'");
98 $this->testActionObjectExtractor->extractActions($this->createBasicActionObjectArray(
""));
109 private function createBasicActionObjectArray($stepKey =
'testAction1', $before =
null, $after =
null)
113 "nodeName" =>
"sampleAction",
114 "stepKey" => $stepKey,
115 "someAttribute" =>
"someAttributeValue" 120 $baseArray[$stepKey] = array_merge($baseArray[$stepKey], [
'before' => $before]);
124 $baseArray[$stepKey] = array_merge($baseArray[$stepKey], [
'after' => $after]);