Skip to content

Commit f712fc3

Browse files
committed
MQE-2076: [PHPUnit 9] assertEquals and assertNotEquals optional parameters removed
1 parent 5ac5683 commit f712fc3

File tree

3 files changed

+123
-6
lines changed

3 files changed

+123
-6
lines changed

etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- Entity value gets replaced in Dom.php before reading $xml -->
1010
<!DOCTYPE config [
11-
<!ENTITY commonTestActions "acceptPopup|actionGroup|amOnPage|amOnUrl|amOnSubdomain|appendField|assertArrayIsSortasserted|assertArraySubset|assertElementContainsAttribute|attachFile|cancelPopup|checkOption|clearField|click|clickWithLeftButton|clickWithRightButton|closeAdminNotification|closeTab|comment|conditionalClick|createData|deleteData|updateData|getData|dontSee|dontSeeJsError|dontSeeCheckboxIsChecked|dontSeeCookie|dontSeeCurrentUrlEquals|dontSeeCurrentUrlMatches|dontSeeElement|dontSeeElementInDOM|dontSeeInCurrentUrl|dontSeeInField|dontSeeInFormFields|dontSeeInPageSource|dontSeeInSource|dontSeeInTitle|dontSeeLink|dontSeeOptionIsSelected|doubleClick|dragAndDrop|entity|executeJS|fillField|formatMoney|generateDate|grabAttributeFrom|grabCookie|grabFromCurrentUrl|grabMultiple|grabPageSource|grabTextFrom|grabValueFrom|loadSessionSnapshot|loginAsAdmin|magentoCLI|magentoCron|makeScreenshot|maximizeWindow|moveBack|moveForward|moveMouseOver|mSetLocale|mResetLocale|openNewTab|pause|parseFloat|pressKey|reloadPage|resetCookie|submitForm|resizeWindow|saveSessionSnapshot|scrollTo|scrollToTopOfPage|searchAndMultiSelectOption|see|seeCheckboxIsChecked|seeCookie|seeCurrentUrlEquals|seeCurrentUrlMatches|seeElement|seeElementInDOM|seeInCurrentUrl|seeInField|seeInFormFields|seeInPageSource|seeInPopup|seeInSource|seeInTitle|seeLink|seeNumberOfElements|seeOptionIsSelected|selectOption|setCookie|submitForm|switchToIFrame|switchToNextTab|switchToPreviousTab|switchToWindow|typeInPopup|uncheckOption|unselectOption|wait|waitForAjaxLoad|waitForElement|waitForElementChange|waitForElementNotVisible|waitForElementVisible|waitForPwaElementNotVisible|waitForPwaElementVisible|waitForJS|waitForLoadingMaskToDisappear|waitForPageLoad|waitForText|assertArrayHasKey|assertArrayNotHasKey|assertArraySubset|assertContains|assertStringContainsString|assertStringContainsStringIgnoringCase|assertCount|assertEmpty|assertEquals|assertFalse|assertFileExists|assertFileNotExists|assertGreaterOrEquals|assertGreaterThan|assertGreaterThanOrEqual|assertInstanceOf|assertInternalType|assertIsEmpty|assertLessOrEquals|assertLessThan|assertLessThanOrEqual|assertNotContains|assertStringNotContainsString|assertStringNotContainsStringIgnoringCase|assertNotEmpty|assertNotEquals|assertNotInstanceOf|assertNotNull|assertNotRegExp|assertNotSame|assertNull|assertRegExp|assertSame|assertStringStartsNotWith|assertStringStartsWith|assertTrue|expectException|fail|dontSeeFullUrlEquals|dontSee|dontSeeFullUrlMatches|dontSeeInFullUrl|seeFullUrlEquals|seeFullUrlMatches|seeInFullUrl|grabFromFullUrl|helper">
11+
<!ENTITY commonTestActions "acceptPopup|actionGroup|amOnPage|amOnUrl|amOnSubdomain|appendField|assertArrayIsSortasserted|assertArraySubset|assertElementContainsAttribute|attachFile|cancelPopup|checkOption|clearField|click|clickWithLeftButton|clickWithRightButton|closeAdminNotification|closeTab|comment|conditionalClick|createData|deleteData|updateData|getData|dontSee|dontSeeJsError|dontSeeCheckboxIsChecked|dontSeeCookie|dontSeeCurrentUrlEquals|dontSeeCurrentUrlMatches|dontSeeElement|dontSeeElementInDOM|dontSeeInCurrentUrl|dontSeeInField|dontSeeInFormFields|dontSeeInPageSource|dontSeeInSource|dontSeeInTitle|dontSeeLink|dontSeeOptionIsSelected|doubleClick|dragAndDrop|entity|executeJS|fillField|formatMoney|generateDate|grabAttributeFrom|grabCookie|grabFromCurrentUrl|grabMultiple|grabPageSource|grabTextFrom|grabValueFrom|loadSessionSnapshot|loginAsAdmin|magentoCLI|magentoCron|makeScreenshot|maximizeWindow|moveBack|moveForward|moveMouseOver|mSetLocale|mResetLocale|openNewTab|pause|parseFloat|pressKey|reloadPage|resetCookie|submitForm|resizeWindow|saveSessionSnapshot|scrollTo|scrollToTopOfPage|searchAndMultiSelectOption|see|seeCheckboxIsChecked|seeCookie|seeCurrentUrlEquals|seeCurrentUrlMatches|seeElement|seeElementInDOM|seeInCurrentUrl|seeInField|seeInFormFields|seeInPageSource|seeInPopup|seeInSource|seeInTitle|seeLink|seeNumberOfElements|seeOptionIsSelected|selectOption|setCookie|submitForm|switchToIFrame|switchToNextTab|switchToPreviousTab|switchToWindow|typeInPopup|uncheckOption|unselectOption|wait|waitForAjaxLoad|waitForElement|waitForElementChange|waitForElementNotVisible|waitForElementVisible|waitForPwaElementNotVisible|waitForPwaElementVisible|waitForJS|waitForLoadingMaskToDisappear|waitForPageLoad|waitForText|assertArrayHasKey|assertArrayNotHasKey|assertArraySubset|assertContains|assertStringContainsString|assertStringContainsStringIgnoringCase|assertCount|assertEmpty|assertEquals|assertFalse|assertFileExists|assertFileNotExists|assertGreaterOrEquals|assertGreaterThan|assertGreaterThanOrEqual|assertInstanceOf|assertInternalType|assertIsEmpty|assertLessOrEquals|assertLessThan|assertLessThanOrEqual|assertNotContains|assertStringNotContainsString|assertStringNotContainsStringIgnoringCase|assertNotEmpty|assertNotEquals|assertNotInstanceOf|assertNotNull|assertNotRegExp|assertNotSame|assertNull|assertRegExp|assertSame|assertStringStartsNotWith|assertStringStartsWith|assertTrue|expectException|fail|dontSeeFullUrlEquals|dontSee|dontSeeFullUrlMatches|dontSeeInFullUrl|seeFullUrlEquals|seeFullUrlMatches|seeInFullUrl|grabFromFullUrl|helper|assertEqualsWithDelta|assertEqualsCanonicalizing|assertEqualsIgnoringCase|assertNotEqualsWithDelta|assertNotEqualsCanonicalizing|assertNotEqualsIgnoringCase">
1212
]>
1313

1414
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../src/Magento/FunctionalTestingFramework/ObjectManager/etc/config.xsd">

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

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<xs:element type="assertCountType" name="assertCount" minOccurs="0" maxOccurs="unbounded"/>
2222
<xs:element type="assertEmptyType" name="assertEmpty" minOccurs="0" maxOccurs="unbounded"/>
2323
<xs:element type="assertEqualsType" name="assertEquals" minOccurs="0" maxOccurs="unbounded"/>
24+
<xs:element type="assertEqualsWithDeltaType" name="assertEqualsWithDelta" minOccurs="0" maxOccurs="unbounded"/>
25+
<xs:element type="assertEqualsCanonicalizingType" name="assertEqualsCanonicalizing" minOccurs="0" maxOccurs="unbounded"/>
26+
<xs:element type="assertEqualsIgnoringCaseType" name="assertEqualsIgnoringCase" minOccurs="0" maxOccurs="unbounded"/>
2427
<xs:element type="assertFalseType" name="assertFalse" minOccurs="0" maxOccurs="unbounded"/>
2528
<xs:element type="assertFileExistsType" name="assertFileExists" minOccurs="0" maxOccurs="unbounded"/>
2629
<xs:element type="assertFileNotExistsType" name="assertFileNotExists" minOccurs="0" maxOccurs="unbounded"/>
@@ -38,6 +41,9 @@
3841
<xs:element type="assertStringNotContainsStringIgnoringCaseType" name="assertStringNotContainsStringIgnoringCase" minOccurs="0" maxOccurs="unbounded"/>
3942
<xs:element type="assertNotEmptyType" name="assertNotEmpty" minOccurs="0" maxOccurs="unbounded"/>
4043
<xs:element type="assertNotEqualsType" name="assertNotEquals" minOccurs="0" maxOccurs="unbounded"/>
44+
<xs:element type="assertNotEqualsWithDeltaType" name="assertNotEqualsWithDelta" minOccurs="0" maxOccurs="unbounded"/>
45+
<xs:element type="assertNotEqualsCanonicalizingType" name="assertNotEqualsCanonicalizing" minOccurs="0" maxOccurs="unbounded"/>
46+
<xs:element type="assertNotEqualsIgnoringCaseType" name="assertNotEqualsIgnoringCase" minOccurs="0" maxOccurs="unbounded"/>
4147
<xs:element type="assertNotInstanceOfType" name="assertNotInstanceOf" minOccurs="0" maxOccurs="unbounded"/>
4248
<xs:element type="assertNotNullType" name="assertNotNull" minOccurs="0" maxOccurs="unbounded"/>
4349
<xs:element type="assertNotRegExpType" name="assertNotRegExp" minOccurs="0" maxOccurs="unbounded"/>
@@ -218,7 +224,21 @@
218224
<xs:complexType name="assertEqualsType">
219225
<xs:annotation>
220226
<xs:documentation>
221-
Asserts that two given variables are equal. Can be given a "delta" to allow precision tolerance in floating point comparison.
227+
Asserts that two given variables are equal.
228+
</xs:documentation>
229+
</xs:annotation>
230+
<xs:choice maxOccurs="unbounded">
231+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
232+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
233+
</xs:choice>
234+
<xs:attribute ref="message"/>
235+
<xs:attributeGroup ref="commonActionAttributes"/>
236+
</xs:complexType>
237+
238+
<xs:complexType name="assertEqualsWithDeltaType">
239+
<xs:annotation>
240+
<xs:documentation>
241+
Asserts that two given variables are equal. Accepts a delta.
222242
</xs:documentation>
223243
</xs:annotation>
224244
<xs:choice maxOccurs="unbounded">
@@ -230,6 +250,36 @@
230250
<xs:attributeGroup ref="commonActionAttributes"/>
231251
</xs:complexType>
232252

253+
<xs:complexType name="assertEqualsIgnoringCaseType">
254+
<xs:annotation>
255+
<xs:documentation>
256+
Asserts that two given variables are equal.
257+
</xs:documentation>
258+
</xs:annotation>
259+
<xs:choice maxOccurs="unbounded">
260+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
261+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
262+
</xs:choice>
263+
<xs:attribute ref="message"/>
264+
<xs:attributeGroup ref="commonActionAttributes"/>
265+
</xs:complexType>
266+
267+
<xs:complexType name="assertEqualsCanonicalizingType">
268+
<xs:annotation>
269+
<xs:documentation>
270+
Asserts that two given variables are equal. The contents are canonicalized before they are compared.
271+
For instance, when the two variables $expected and $actual are arrays, then these arrays are
272+
sorted before they are compared.
273+
</xs:documentation>
274+
</xs:annotation>
275+
<xs:choice maxOccurs="unbounded">
276+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
277+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
278+
</xs:choice>
279+
<xs:attribute ref="message"/>
280+
<xs:attributeGroup ref="commonActionAttributes"/>
281+
</xs:complexType>
282+
233283
<xs:complexType name="assertFalseType">
234284
<xs:annotation>
235285
<xs:documentation>
@@ -452,15 +502,59 @@
452502
<xs:complexType name="assertNotEqualsType">
453503
<xs:annotation>
454504
<xs:documentation>
455-
Asserts that actual and expected are not equal. Can be given a "delta" to allow precision tolerance in floating point comparison.
505+
Asserts that actual and expected are not equal.
456506
</xs:documentation>
457507
</xs:annotation>
458508
<xs:choice maxOccurs="unbounded">
459509
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
460510
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
461511
</xs:choice>
462512
<xs:attribute ref="message"/>
513+
<xs:attributeGroup ref="commonActionAttributes"/>
514+
</xs:complexType>
515+
516+
<xs:complexType name="assertNotEqualsWithDeltaType">
517+
<xs:annotation>
518+
<xs:documentation>
519+
Asserts that two given variables are not equal. Accepts a delta.
520+
</xs:documentation>
521+
</xs:annotation>
522+
<xs:choice maxOccurs="unbounded">
523+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
524+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
525+
</xs:choice>
463526
<xs:attribute ref="delta"/>
527+
<xs:attribute ref="message"/>
528+
<xs:attributeGroup ref="commonActionAttributes"/>
529+
</xs:complexType>
530+
531+
<xs:complexType name="assertNotEqualsIgnoringCaseType">
532+
<xs:annotation>
533+
<xs:documentation>
534+
Asserts that actual and expected are not equal.
535+
</xs:documentation>
536+
</xs:annotation>
537+
<xs:choice maxOccurs="unbounded">
538+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
539+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
540+
</xs:choice>
541+
<xs:attribute ref="message"/>
542+
<xs:attributeGroup ref="commonActionAttributes"/>
543+
</xs:complexType>
544+
545+
<xs:complexType name="assertNotEqualsCanonicalizingType">
546+
<xs:annotation>
547+
<xs:documentation>
548+
Asserts that two given variables are equal. The contents are canonicalized before they are compared.
549+
For instance, when the two variables $expected and $actual are arrays, then these arrays are
550+
sorted before they are compared.
551+
</xs:documentation>
552+
</xs:annotation>
553+
<xs:choice maxOccurs="unbounded">
554+
<xs:element name="expectedResult" type="expectedResultType" minOccurs="0"/>
555+
<xs:element name="actualResult" type="actualResultType" minOccurs="0"/>
556+
</xs:choice>
557+
<xs:attribute ref="message"/>
464558
<xs:attributeGroup ref="commonActionAttributes"/>
465559
</xs:complexType>
466560

@@ -669,4 +763,4 @@
669763
<xs:enumeration value="const"/>
670764
</xs:restriction>
671765
</xs:simpleType>
672-
</xs:schema>
766+
</xs:schema>

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,15 +1272,13 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
12721272
$visible
12731273
);
12741274
break;
1275-
case "assertEquals":
12761275
case "assertGreaterOrEquals":
12771276
case "assertGreaterThan":
12781277
case "assertGreaterThanOrEqual":
12791278
case "assertInternalType":
12801279
case "assertLessOrEquals":
12811280
case "assertLessThan":
12821281
case "assertLessThanOrEqual":
1283-
case "assertNotEquals":
12841282
case "assertInstanceOf":
12851283
case "assertNotInstanceOf":
12861284
case "assertNotRegExp":
@@ -1308,6 +1306,31 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
13081306
$assertDelta
13091307
);
13101308
break;
1309+
case "assertEquals":
1310+
case "assertNotEquals":
1311+
case "assertEqualsIgnoringCase":
1312+
case "assertNotEqualsIgnoringCase":
1313+
case "assertEqualsCanonicalizing":
1314+
case "assertNotEqualsCanonicalizing":
1315+
$testSteps .= $this->wrapFunctionCall(
1316+
$actor,
1317+
$actionObject,
1318+
$assertExpected,
1319+
$assertActual,
1320+
$assertMessage
1321+
);
1322+
break;
1323+
case "assertEqualsWithDelta":
1324+
case "assertNotEqualsWithDelta":
1325+
$testSteps .= $this->wrapFunctionCall(
1326+
$actor,
1327+
$actionObject,
1328+
$assertExpected,
1329+
$assertActual,
1330+
$assertDelta,
1331+
$assertMessage
1332+
);
1333+
break;
13111334
case "assertElementContainsAttribute":
13121335
// If a blank string or null is passed in we need to pass a blank string to the function.
13131336
if (empty($assertExpected)) {

0 commit comments

Comments
 (0)