Skip to content

Commit 51b6fad

Browse files
Manjusha.SManjusha.S
authored andcommitted
Resolved conflicts
1 parent fc5de4c commit 51b6fad

File tree

4 files changed

+42
-10
lines changed

4 files changed

+42
-10
lines changed

dev/tests/verification/Resources/DataActionsTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class DataActionsTestCest
3232
$I->createEntity("createdInBefore", "hook", "entity", [], []); // stepKey: createdInBefore
3333
$I->updateEntity("createdInBefore", "hook", "entity",[]); // stepKey: updateInBefore
3434
$I->deleteEntity("createdInBefore", "hook"); // stepKey: deleteInBefore
35+
$customerFields['lastname'] = "foo61f90e3156e25";
36+
$I->createEntity("customer", "hook", "Simple_Customer_Without_Address", [], $customerFields); // stepKey: customer
3537
$I->comment('[END BEFORE HOOK]');
3638
}
3739

dev/tests/verification/TestModule/Test/DataActionsTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<createData entity="entity" stepKey="createdInBefore"/>
1414
<updateData entity="entity" createDataKey="createdInBefore" stepKey="updateInBefore"/>
1515
<deleteData createDataKey="createdInBefore" stepKey="deleteInBefore"/>
16+
<createData stepKey="customer" entity="Simple_Customer_Without_Address">
17+
<field key="lastname" unique="suffix" >foo</field>
18+
</createData>
1619

1720
</before>
1821
<waitForElementClickable selector=".functionalTestSelector" time="30" stepKey="waitForElementClickable" />

src/Magento/FunctionalTestingFramework/Test/etc/Actions/dataActions.xsd

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,32 @@
125125
</xs:simpleContent>
126126
</xs:complexType>
127127

128+
128129
<xs:complexType name="additionalFieldType">
129-
<xs:annotation>
130-
<xs:documentation>field used to override defined fields from metadata or existing data definitions, during operation.</xs:documentation>
131-
</xs:annotation>
132130
<xs:simpleContent>
133131
<xs:extension base="xs:string">
134-
<xs:attribute name="key" use="required"/>
132+
<xs:attribute type="xs:string" name="key" use="optional">
133+
<xs:annotation>
134+
<xs:documentation>xp
135+
Key attribute of data/value pair.
136+
</xs:documentation>
137+
</xs:annotation>
138+
</xs:attribute>
139+
<xs:attribute type="uniquenessEnumType" name="unique" use="optional">
140+
<xs:annotation>
141+
<xs:documentation>
142+
Add suite or test wide unique sequence as "prefix" or "suffix" to the data value if specified.
143+
</xs:documentation>
144+
</xs:annotation>
145+
</xs:attribute>
135146
</xs:extension>
136147
</xs:simpleContent>
137148
</xs:complexType>
138-
</xs:schema>
149+
150+
<xs:simpleType name="uniquenessEnumType">
151+
<xs:restriction base="xs:string">
152+
<xs:enumeration value="prefix" />
153+
<xs:enumeration value="suffix" />
154+
</xs:restriction>
155+
</xs:simpleType>
156+
</xs:schema>

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,11 @@ private function generateMethodAnnotations($annotationType = null, $annotationNa
525525
break;
526526

527527
case null:
528-
$annotationToAppend = "";
528+
$annotationToAppend = sprintf(
529+
"{$indent} * @Parameter(name = \"%s\", value=\"$%s\")\n",
530+
"AcceptanceTester",
531+
"I"
532+
);
529533
$annotationToAppend .= sprintf("{$indent} * @param %s $%s\n", "AcceptanceTester", "I");
530534
$annotationToAppend .= "{$indent} * @return void\n";
531535
$annotationToAppend .= "{$indent} * @throws \Exception\n";
@@ -1462,11 +1466,14 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
14621466
$actionObject->getActionOrigin()
14631467
)[0];
14641468
$argRef = "\t\t\$";
1465-
14661469
$input = $this->resolveAllRuntimeReferences([$input])[0];
1470+
if (isset($actionObject->getCustomActionAttributes()['unique'])) {
1471+
$input = ($actionObject->getCustomActionAttributes()['unique'] == 'prefix')
1472+
? '"'.uniqid().str_replace('"', '', $input).'"'
1473+
: '"'.str_replace('"', '', $input).uniqid().'"';
1474+
}
14671475
$argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) .
14681476
"Fields['{$fieldKey}'] = ${input};";
1469-
14701477
$testSteps .= $argRef;
14711478
break;
14721479
case "generateDate":
@@ -1801,7 +1808,7 @@ private function generateHooksPhp($hookObjects)
18011808
$hooks .= $steps;
18021809
if ($type === 'after') {
18031810
$hooks .= "\t\t" . 'if ($this->isSuccess) {' . "\n";
1804-
$hooks .= "\t\t\t" . 'unlink(__FILE__);' . "\n";
1811+
// $hooks .= "\t\t\t" . 'unlink(__FILE__);' . "\n";
18051812
$hooks .= "\t\t" . '}' . "\n";
18061813
}
18071814
$hooks .= "\t}\n\n";
@@ -1841,7 +1848,7 @@ private function generateTestPhp($test)
18411848
} else {
18421849
$skipString .= "No issues have been specified.";
18431850
}
1844-
$steps = "\t\t" . 'unlink(__FILE__);' . "\n";
1851+
// $steps = "\t\t" . 'unlink(__FILE__);' . "\n";
18451852
$steps .= "\t\t" . '$scenario->skip("' . $skipString . '");' . "\n";
18461853
$dependencies .= ', \Codeception\Scenario $scenario';
18471854
}
@@ -1861,6 +1868,8 @@ private function generateTestPhp($test)
18611868
$testPhp .= "\t}\n";
18621869
}
18631870

1871+
echo $testPhp;
1872+
exit;
18641873
return $testPhp;
18651874
}
18661875

0 commit comments

Comments
 (0)