Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Since the commit of #2923567: Select from correct entity tables for additional entity/field definitions when moving data to dedicated table storage from shared table storage for the purposes of purging, EntityDefinitionUpdateTest
fails with contrib db driver.
1) Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData with data set "Revisionable entity type, non revisionable base field" ('entity_test_mulrev', true, false)
Failed asserting that Array &0 (
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'bundle' => 'entity_test_mulrev'
'new_base_field_value' => 'bar'
) is identical to Array &0 (
'bundle' => 'entity_test_mulrev'
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'new_base_field_value' => 'bar'
).
/home/travis/drupal8/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php:476
2) Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData with data set "Revisionable entity type, revisionable base field" ('entity_test_mulrev', true, true)
Failed asserting that Array &0 (
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'bundle' => 'entity_test_mulrev'
'new_base_field_value' => 'bar'
) is identical to Array &0 (
'bundle' => 'entity_test_mulrev'
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'new_base_field_value' => 'bar'
).
/home/travis/drupal8/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php:476
3) Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData with data set "Non-translatable revisionable entity type, revisionable base field" ('entity_test_rev', true, true)
Failed asserting that Array &0 (
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'bundle' => 'entity_test_rev'
'new_base_field_value' => 'bar'
) is identical to Array &0 (
'bundle' => 'entity_test_rev'
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'new_base_field_value' => 'bar'
).
/home/travis/drupal8/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php:476
4) Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData with data set "Non-translatable revisionable entity type, non-revisionable base field" ('entity_test_rev', true, false)
Failed asserting that Array &0 (
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'bundle' => 'entity_test_rev'
'new_base_field_value' => 'bar'
) is identical to Array &0 (
'bundle' => 'entity_test_rev'
'deleted' => '1'
'entity_id' => '2'
'revision_id' => '3'
'langcode' => 'en'
'delta' => '0'
'new_base_field_value' => 'bar'
).
/home/travis/drupal8/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php:476
This is because the test checks for the identicality of an expected array to the actual results. The assert relies on the fact that not only array values are the same, but also about the sequence of the keys in the array.
Proposed resolution
Use assertEquals instead of assertSame
Remaining tasks
review
User interface changes
na
API changes
na
Data model changes
na
Comment | File | Size | Author |
---|---|---|---|
#2 | 2930197-2.patch | 1.4 KB | mondrake |
Comments
Comment #2
mondrakeComment #3
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedOops.. :)
Comment #4
plachJust out of curiosity: which DB driver are we talking about?
Comment #5
mondrakeCiao Francesco, have a look at #2925750-5: EntityDefinitionUpdateTest fails with contrib db driver.
Comment #6
plachCiao :)
Very interesting stuff, thanks! I will commit this ASAP.
Comment #8
plachCommitted 8c44f20 and pushed to 8.5.x. Thanks!