This is a follow-up task for #2756519: Convert assertIdentical() to assertSame() for some uses in kernel tests that already have assertSame()'s parameter order, since just replacing it didn't work for the whole testbase. The previous task is now only about kernel tests.
It's unclear if other core tests than kernel tests should also have their assertIdentical methods removed in favour of assertSame.
This should be simple with sed:
grep -rl assertIdentical /path/to/Drupal | xargs sed -i s@assertIdentical@assertSame@g
There are other similar functions, it's also unclear if these should be replaced as well.
Comment | File | Size | Author |
---|---|---|---|
#44 | 2867959-44-91x.patch | 586.51 KB | mondrake |
Issue fork drupal-2867959
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:
- 2867959-replace-usages-of changes, plain diff MR !260
Comments
Comment #3
danielnv18Comment #4
danielnv18well, it didn't go as smooth as I thought. I will keep working on it
Comment #5
danielnv18Let's try again
Comment #6
danielnv18Comment #7
danielnv18Comment #8
dawehnerIMHO we should do the same as in the kernel test issue aka. just convert the usages where the parameter order was already right.
Comment #14
kkalashnikov CreditAttribution: kkalashnikov at Material for Drupal India Association commentedThis patch is failing for drupal 9.1. So moving the ticket to need work.
Comment #15
kkalashnikov CreditAttribution: kkalashnikov at Material for Drupal India Association commentedComment #16
mondrakeReparenting, and postponing on #3114617: Properly deprecate methods in Drupal\FunctionalTests\AssertLegacyTrait and Drupal\KernelTests\AssertLegacyTrait, while still keeping deprecations silenced
Comment #17
mondrake#3114617: Properly deprecate methods in Drupal\FunctionalTests\AssertLegacyTrait and Drupal\KernelTests\AssertLegacyTrait, while still keeping deprecations silenced is in.
Comment #18
mondrakeRestart fresh, by removing the deprecation silencer. Let's see the size of the prize.
Comment #19
mondrakeSuggest to wait for more issues from the meta #3128573: [meta] Replace assertions with more appropriate ones to be completed before tackling this one.
Comment #20
jungleAdding the "Deprecated assertions" tag to add this into the kanban board https://contribkanban.com/board/Deprecatedassertions
Comment #21
mondrakeFiled #3142351: Replace usages of AssertLegacyTrait::assertIdentical() in traits and base classes to have a first reduction of scope here by removing occurences in traits and base classes. Even with that in there will be more than 1500 conversions to be done, so this will likely need further slicing.
Comment #22
mondrakeComment #23
xjmYep, I would also definitely make
assertIdentical()
andassertNotIdentical()
separate patches for example.A very large patch is OK if it literally only changes exactly one thing.
git diff --color-words
is scannable, and if the reviewer tires too much from that,git diff --porecelain
can be used with a script to verify the results. (For example I usedgit diff --porcelain
to review a 12 GB patch to convert allarray()
in core to[]
.)Comment #24
xjmNote however that #23 only works if we do not do other cleanups like switching the order of arguments in the same patch. It needs to be only 1:1 replacements of the method name for best reviewability.
Comment #25
xjmComment #27
mondrakeRescoping to remove
assertIdentical
sinceassertNotIdentical
has been converted already.Comment #28
mondrakeThinking again, let’s have an issue that swaps the arguments (where appropriate) first. Then this one will be a mere search and replace.
Comment #29
mondrakeFiled #3192221: [backport] Swap assertIdentical arguments in preparation to replace with assertSame.
Comment #31
mondrakeBlocker was committed, this is the final leap.
Comment #32
mondrakeComment #33
daffie CreditAttribution: daffie commentedTestbot is not happy.
Comment #34
mondrakeComment #35
daffie CreditAttribution: daffie commentedAll the code changes look good to me.
There is a deprecation message test added.
The suppression of the deprecation message has been removed.
All instances of assertIdentical() have been replaced or we would have had an error message.
For me it is RTBC.
Comment #36
catchNeeds a rebase (already).
Comment #37
mondrakeJust patch context reroll, due to 2 context lines being changed in #3193600: Convert assertEqual() calls involving NULL, TRUE and FALSE to more appropriate PHPUnit assertions
Comment #39
catchCommitted/pushed to 9.2.x, thanks!
Needs another rebase against 9.1.x
Comment #40
catchComment #41
mondrakeNeeds #3192221: [backport] Swap assertIdentical arguments in preparation to replace with assertSame first.
Comment #43
catch#3192221: [backport] Swap assertIdentical arguments in preparation to replace with assertSame is in.
Comment #44
mondrakeReroll for 9.1
Comment #45
longwaveApplies cleanly to 9.1.x, no instances remain. The suppression is still in place as we should only change that in 9.2.x.
Comment #46
catchCommitted 3edfa21 and pushed to 9.1.x. Thanks!
Comment #51
quietone CreditAttribution: quietone as a volunteer commentedClosed #2908842: Replace deprecated function calls in CKEditorLoadingTest as duplicate.