By mondrake on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.1.x
Introduced in version:
11.1.0
Issue links:
Description:
sebastianbergmann/comparator:5.0.2 changed to way it processes arrays/objects in PHPUnits assertEqualsCanonicalizing().
It will now throw the failure below if the input isn't a list, so sequenced 0...n.
Drupal\Tests\system\Kernel\Common\UrlTest::testLinkBubbleableMetadata
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
'contexts' => Array (
0 => 'languages:language_interface'
- 1 => 'session'
- 2 => 'theme'
- 3 => 'user.permissions'
+ 1 => 'theme'
+ 2 => 'user.permissions'
+ 6 => 'session'
)
'tags' => []
'max-age' => -1
)
core/modules/system/tests/src/Kernel/Common/UrlTest.php:71
Note the values are the same for actual and expected but the keys of actual are not a list.
On encountering this test failure, you may attempt to overcome this by returning the array_values() of the method that causes the test-failure, since we're mostly only interested in the values anyway.
In core we did this for the following methods:
Cache::mergeTags() and Cache::mergeContexts() now return actual lists i.e. after removing dupes, the resulting array is sequenced 0...n.
Impacts:
Module developers