Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
The optional $canonicalize parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsCanonicalizing() instead.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#10 | 3126333-8.9.x.patch | 1.65 KB | longwave |
#4 | 3126333-4.patch | 2.79 KB | longwave |
Comments
Comment #2
mondrakeKickoff patch, unsilencing the deprecation to see size of the pie.
Comment #4
longwaveassertEqualsCanonicalizing() was added in PHPUnit 7.5 so we cannot do a straight backport, we would need a forward-compatibility shim. But I am not sure it matters for such a tiny diff?
Comment #5
mondrake#3118454: Drupal\KernelTests\Core\Database\SelectTest fails on postgres 10 already introduced usage of the method in D9 only. I see this is quite similar. LGTM
Comment #8
catchOpened #3126695: [D8 only] Add forwards-compatibility shim for assertEqualsCanonicalizing() in phpunit 6&7 against 8.9.x - not really so that we can backport this, but because it would help contrib compatibility. However if we did do that, we could backport this, so I guess it makes sense to leave open.
Comment #10
longwaveComment #11
mondrakethanks, lgtm
Comment #12
xjm8.9.x supports PHP 7.0, and therefore needs compatibility with PHPUnit 6. Are we sure we don't need a PHPUnit 6 shim for this?
I queued some tests on PHP 7.0 environments.
Comment #13
xjmLooks like the PHP 7.0 tests passed, which should have used PHPUnit 6. ...Ah, and it's already provided in the PHPUnit 6
PhpunitCompatibilityTraitTest
. Cool.What on earth are those extra arguments in HEAD, the
0.0
and10
? The only reference I could find is:...But that's not what we had before.
I blamed this and it was added in #1267508-67: Subselects don't work in DBTNG conditions, except when used as value for IN with the comment:
But that still doesn't explain what's up with these extra args or what they're providing coverage for... at the time, it might still have been SimpleTest assertions. 🤷♀️
Since this is a DB test, I'm going to queue tests against the various supported databases.
Comment #14
mondrake#13 those are legacy PHPUnit arguments of the
assertEquals
method, that were used to provide a tolerance delta for float comparison ($delta) and to specify the max nesting level when comparing nested arrays/objects.PHPUnit got rid of the catch-em-all method in favour of specialized equality assertions in https://github.com/sebastianbergmann/phpunit/issues/3341. We are catching up with that here, natively in D9 and with fc shims in D8.
We used to have an assertEquals override in Drupal (guess that's the one you found, @xjm), that was removed in D8.9, see #3082340: Replace assertEquals() overrides in PHPUnit Kernel, Functional and FunctionalJavascript tests with a MarkupInterfaceComparator implementation, but not backported, see comment #67 there.
Comment #17
xjmThanks @mondrake! Mystery solved. How weird.
The tests for older databases passed, so committed #10 to 8.9.x and cherry-picked to 8.8.x.