Problem/Motivation

We're working towards replacing assertEqual with assertEquals. assertEquals requires the arguments to be ($expected, $actual, ...), whereas assertEqual requires ($actual, $expected,...).

Proposed resolution

In preparation for the final cleanup, change all assertEqual calls to have ($expected, $actual, ...) like assertEquals so that in a follow up we can just search/replace the method name.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3193955

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Assigned: Unassigned » mondrake
daffie’s picture

Is it an idea to split this issue up into multiple parts to make reviewing a bit easier. Say 200kb pieces?

mondrake’s picture

Status: Active » Needs work

I am on this. #3 is not easy, unfortunately. An initial change can be scripted, but then like as in the assertIdentical conversion issue, many calls to assertEqual in HEAD are already with the args order that is expected for assertEquals, so we need to git add them after manual review. Let's see where we land.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review

For review. It's a large change, still exclusively swapping the first and the second arguments of assertEqual calls, where appropriate. No other changes.

Reviewers, please only address the following question: is the first argument now corresponding to what we expect the correct value should be? If not, we have to revert the change.

It's just too easy to fall in the pitfall of pursuing more optimizations here (there's plenty...) but we should stick to this minimum scope.

mondrake’s picture

Fixes according to comments in MR

daffie’s picture

Status: Needs review » Needs work

One nitpick left.

mondrake’s picture

Status: Needs work » Needs review

Fixed

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All the changes look good to me.
For me it is RTBC.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Reviewed with --color-words. I found one issue in breadcrumb module (see comment on the MR). But I only reviewed up until the end of image module so far.

mondrake’s picture

Status: Needs work » Reviewed & tested by the community

Reverted BookBreadcrumbTest changes.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Got to the end of the MR and found another couple I think.

mondrake’s picture

Status: Needs work » Reviewed & tested by the community

Thank you for your reviews @daffie @catch... I know it's a big one to work on.

  • catch committed afd86e7 on 9.2.x
    Issue #3193955 by mondrake, daffie, catch: Swap assertEqual arguments in...
catch’s picture

Title: Swap assertEqual arguments in preparation to replace with assertEquals » [backport] Swap assertEqual arguments in preparation to replace with assertEquals
Version: 9.2.x-dev » 9.1.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Committed afd86e7 and pushed to 9.2.x. Thanks!

Needs a re-roll/rebase for 9.1.x

mondrake’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new1.11 MB

Reroll for 9.1

Status: Needs review » Needs work

The last submitted patch, 18: 3193955-18.patch, failed testing. View results

anmolgoyal74’s picture

StatusFileSize
new1.11 MB
new1.58 KB

The view display name needs to be changed to "Master" in core/modules/views/tests/src/Functional/Plugin/DisplayTest.php 9.1.x. This has been modified in #3186582: Replace the word "master" with "default" in Views in 9.2.x only.

Here's the link to the commit
https://git.drupalcode.org/project/drupal/-/commit/21bd33d6ce9adebedd61b...

anmolgoyal74’s picture

Status: Needs work » Needs review
daffie’s picture

Status: Needs review » Reviewed & tested by the community

I used the linux command "diff" to see what the differences are between the 2 patch files. All the differences are expected, therefore for me it is RTBC.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed f56797a and pushed to 9.1.x. Thanks!

  • catch committed f56797a on 9.1.x
    Issue #3193955 by mondrake, anmolgoyal74, daffie: Swap assertEqual...
catch’s picture

Title: [backport] Swap assertEqual arguments in preparation to replace with assertEquals » Swap assertEqual arguments in preparation to replace with assertEquals

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.