Skip to content

Commit bbab15d

Browse files
authored
Merge pull request #675 from magento/MQE-2076
MQE-2076: [PHPUnit 9] assertEquals and assertNotEquals optional parameters removed
2 parents 4f1dd85 + f12f282 commit bbab15d

File tree

6 files changed

+224
-10
lines changed

6 files changed

+224
-10
lines changed

dev/tests/verification/Resources/AssertTest.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AssertTestCest
6969
$I->assertStringNotContainsStringIgnoringCase("apple", "banana", "pass"); // stepKey: assertStringNotContainsStringIgnoringCase
7070
$I->assertNotEmpty([1, 2], "pass"); // stepKey: assertNotEmpty1
7171
$I->assertNotEmpty($text, "pass"); // stepKey: assertNotEmpty2
72-
$I->assertNotEquals(2, 5, "pass", 0); // stepKey: assertNotEquals
72+
$I->assertNotEquals(2, 5, "pass"); // stepKey: assertNotEquals
7373
$I->assertNotNull("abc", "pass"); // stepKey: assertNotNull1
7474
$I->assertNotNull($text, "pass"); // stepKey: assertNotNull2
7575
$I->assertNotRegExp("/foo/", "bar", "pass"); // stepKey: assertNotRegExp
@@ -105,7 +105,7 @@ class AssertTestCest
105105
$I->assertNotContains("bc", $text, "pass"); // stepKey: assertNotContains2BackwardCompatible
106106
$I->assertNotEmpty([1, 2], "pass"); // stepKey: assertNotEmpty1BackwardCompatible
107107
$I->assertNotEmpty($text, "pass"); // stepKey: assertNotEmpty2BackwardCompatible
108-
$I->assertNotEquals(2, 5, "pass", 0); // stepKey: assertNotEqualsBackwardCompatible
108+
$I->assertNotEquals(2, 5, "pass"); // stepKey: assertNotEqualsBackwardCompatible
109109
$I->assertNotNull("abc", "pass"); // stepKey: assertNotNull1BackwardCompatible
110110
$I->assertNotNull($text, "pass"); // stepKey: assertNotNull2BackwardCompatible
111111
$I->assertNotRegExp("/foo/", "bar", "pass"); // stepKey: assertNotRegExpBackwardCompatible
@@ -155,5 +155,11 @@ class AssertTestCest
155155
$I->assertElementContainsAttribute("#username", "value", $I->retrieveEntityField('createData1', 'firstname', 'test')); // stepKey: assertElementContainsAttribute8
156156
$I->comment("assert entity resolution");
157157
$I->assertEquals("John", "Doe", "pass"); // stepKey: assertEqualsEntity
158+
$I->assertEqualsWithDelta(10.0000, 10.0000, 1, "pass"); // stepKey: a1
159+
$I->assertNotEqualsWithDelta(10.0000, 12.0000, 1, "pass"); // stepKey: a2
160+
$I->assertEqualsCanonicalizing(["4", "2", "1", "3"], ["1", "2", "3", "4"], "pass"); // stepKey: a3
161+
$I->assertNotEqualsCanonicalizing(["5", "8", "7", "9"], ["1", "2", "3", "4"], "pass"); // stepKey: a4
162+
$I->assertEqualsIgnoringCase("Cat", "cat", "pass"); // stepKey: a5
163+
$I->assertNotEqualsIgnoringCase("Cat", "Dog", "pass"); // stepKey: a6
158164
}
159165
}

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<assertNotEmpty stepKey="assertNotEmpty2" message="pass">
130130
<actualResult type="variable">text</actualResult>
131131
</assertNotEmpty>
132-
<assertNotEquals stepKey="assertNotEquals" message="pass" delta="">
132+
<assertNotEquals stepKey="assertNotEquals" message="pass">
133133
<expectedResult type="int">2</expectedResult>
134134
<actualResult type="int">5</actualResult>
135135
</assertNotEquals>
@@ -259,7 +259,7 @@
259259
<assertNotEmpty stepKey="assertNotEmpty2BackwardCompatible" message="pass">
260260
<actualResult type="variable">text</actualResult>
261261
</assertNotEmpty>
262-
<assertNotEquals stepKey="assertNotEqualsBackwardCompatible" message="pass" delta="">
262+
<assertNotEquals stepKey="assertNotEqualsBackwardCompatible" message="pass">
263263
<actualResult type="int">5</actualResult>
264264
<expectedResult type="int">2</expectedResult>
265265
</assertNotEquals>
@@ -415,5 +415,30 @@
415415
<expectedResult type="string">{{simpleData.firstname}}</expectedResult>
416416
<actualResult type="string">{{simpleData.lastname}}</actualResult>
417417
</assertEquals>
418+
419+
<assertEqualsWithDelta stepKey="a1" message="pass" delta="1">
420+
<expectedResult type="const">10.0000</expectedResult>
421+
<actualResult type="const">10.0000</actualResult>
422+
</assertEqualsWithDelta>
423+
<assertNotEqualsWithDelta stepKey="a2" message="pass" delta="1">
424+
<expectedResult type="const">10.0000</expectedResult>
425+
<actualResult type="const">12.0000</actualResult>
426+
</assertNotEqualsWithDelta>
427+
<assertEqualsCanonicalizing stepKey="a3" message="pass">
428+
<expectedResult type="array">[4, 2, 1, 3]</expectedResult>
429+
<actualResult type="array">[1, 2, 3, 4]</actualResult>
430+
</assertEqualsCanonicalizing>
431+
<assertNotEqualsCanonicalizing stepKey="a4" message="pass">
432+
<expectedResult type="array">[5, 8, 7, 9]</expectedResult>
433+
<actualResult type="array">[1, 2, 3, 4]</actualResult>
434+
</assertNotEqualsCanonicalizing>
435+
<assertEqualsIgnoringCase stepKey="a5" message="pass">
436+
<expectedResult type="string">Cat</expectedResult>
437+
<actualResult type="string">cat</actualResult>
438+
</assertEqualsIgnoringCase>
439+
<assertNotEqualsIgnoringCase stepKey="a6" message="pass">
440+
<expectedResult type="string">Cat</expectedResult>
441+
<actualResult type="string">Dog</actualResult>
442+
</assertNotEqualsIgnoringCase>
418443
</test>
419444
</tests>

docs/test/assertions.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ Attribute|Type|Use|Description
179179

180180
See [assertEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEquals).
181181

182+
Attribute|Type|Use|Description
183+
---|---|---|---
184+
`message`|string|optional|Text of informational message about a cause of failure.
185+
`stepKey`|string|required| A unique identifier of the text step.
186+
`before`|string|optional| `stepKey` of action that must be executed next.
187+
`after`|string|optional| `stepKey` of the preceding action.
188+
189+
### assertEqualsWithDelta
190+
191+
See [assertEqualsWithDelta docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEqualsWithDelta).
192+
182193
Attribute|Type|Use|Description
183194
---|---|---|---
184195
`delta`|string|optional|
@@ -187,6 +198,28 @@ Attribute|Type|Use|Description
187198
`before`|string|optional| `stepKey` of action that must be executed next.
188199
`after`|string|optional| `stepKey` of the preceding action.
189200

201+
### assertEqualsCanonicalizing
202+
203+
See [assertEqualsCanonicalizing docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEqualsCanonicalizing).
204+
205+
Attribute|Type|Use|Description
206+
---|---|---|---
207+
`message`|string|optional|Text of informational message about a cause of failure.
208+
`stepKey`|string|required| A unique identifier of the text step.
209+
`before`|string|optional| `stepKey` of action that must be executed next.
210+
`after`|string|optional| `stepKey` of the preceding action.
211+
212+
### assertEqualsIgnoringCase
213+
214+
See [assertEqualsIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEqualsIgnoringCase).
215+
216+
Attribute|Type|Use|Description
217+
---|---|---|---
218+
`message`|string|optional|Text of informational message about a cause of failure.
219+
`stepKey`|string|required| A unique identifier of the text step.
220+
`before`|string|optional| `stepKey` of action that must be executed next.
221+
`after`|string|optional| `stepKey` of the preceding action.
222+
190223
### assertFalse
191224

192225
See [assertFalse docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertFalse).
@@ -367,6 +400,17 @@ Attribute|Type|Use|Description
367400

368401
See [assertNotEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEquals).
369402

403+
Attribute|Type|Use|Description
404+
---|---|---|---
405+
`message`|string|optional|Text of informational message about a cause of failure.
406+
`stepKey`|string|required| A unique identifier of the text step.
407+
`before`|string|optional| `stepKey` of action that must be executed next.
408+
`after`|string|optional| `stepKey` of the preceding action.
409+
410+
### assertNotEqualsWithDelta
411+
412+
See [assertNotEqualsWithDelta docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEqualsWithDelta).
413+
370414
Attribute|Type|Use|Description
371415
---|---|---|---
372416
`delta`|string|optional|
@@ -375,6 +419,28 @@ Attribute|Type|Use|Description
375419
`before`|string|optional| `stepKey` of action that must be executed next.
376420
`after`|string|optional| `stepKey` of the preceding action.
377421

422+
### assertNotEqualsCanonicalizing
423+
424+
See [assertNotEqualsCanonicalizing docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEqualsCanonicalizing).
425+
426+
Attribute|Type|Use|Description
427+
---|---|---|---
428+
`message`|string|optional|Text of informational message about a cause of failure.
429+
`stepKey`|string|required| A unique identifier of the text step.
430+
`before`|string|optional| `stepKey` of action that must be executed next.
431+
`after`|string|optional| `stepKey` of the preceding action.
432+
433+
### assertNotEqualsIgnoringCase
434+
435+
See [assertNotEqualsIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEqualsIgnoringCase).
436+
437+
Attribute|Type|Use|Description
438+
---|---|---|---
439+
`message`|string|optional|Text of informational message about a cause of failure.
440+
`stepKey`|string|required| A unique identifier of the text step.
441+
`before`|string|optional| `stepKey` of action that must be executed next.
442+
`after`|string|optional| `stepKey` of the preceding action.
443+
378444
### assertNotInstanceOf
379445

380446
See [assertNotInstanceOf docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotInstanceOf).

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">

0 commit comments

Comments
 (0)