Problem/Motivation
assertArraySubset() is deprecated and will be removed in PHPUnit 9.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | interdiff.3126564.4-8.txt | 8.78 KB | longwave |
| #8 | 3126564-8.patch | 13.54 KB | longwave |
Comments
Comment #2
mondrakeKickoff patch, unsilencing the deprecation to see size of the changes needed.
Comment #4
longwaveHad a go at the easier ones, run out of time now to do the rest,
Comment #6
jungleIt seems hard to get this done, as no alternative suggested.
assertArraySubset()intoassertAssocArraySubset($subset, $array, $strict=false)andassertIndexArraySubset($subset, $array, $order=false, $strict=false)from the comment here and Array Subset does not work as expected on indexed / flat arrays #3101, so maybe we should wrapper it asassertAssocArraySubset()to make it more clear.It seems @sebastianbergmann, the creator of PHPUnit does not object to using it, he just did not want to maintain it in the standard distribution.
Comment #7
mondrakeCan we use
assertSameinstead ofassertIdenticalthat is (should be) deprecated.Comment #8
longwaveThe only complicated case is in EntityResourceTestBase:
Here we need to add our own recursive helper method.
Comment #9
jungleUnfortunately, all haystacks in the patch are arrays :p
Queued the patch against 9.0.x and it passed.
All good to me and learned from the patch, +1 to
\Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::assertEntityArraySubset()Thanks!
Comment #12
catchCommitted 09be91a and pushed to 9.1.x, cherry-picked to 9.0.x. Thanks!