Drupal 11 Compatibility

Created on 26 March 2025, 5 months ago

Problem/Motivation

The rector patch https://www.drupal.org/project/entitygroupfield/issues/3438342 πŸ“Œ Automated Drupal 11 compatibility fixes for entitygroupfield Needs review is incomplete. It needs to remove variationcache references. Group does not need this any more, so there is no need for it. It is only used in the test file.

Proposed resolution

  • constrain the version numbers in both .info.yml and in composer.json
  • remove variationcache requirement
πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Chris Dart

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Chris Dart
  • Pipeline finished with Failed
    5 months ago
    Total: 392s
    #458164
  • πŸ‡ΊπŸ‡ΈUnited States Chris Dart

    I'm not sure why the pipeline is failing, but I believe this is ready for review. The changes appear to work correctly in a client's installation. So I may have made an error in the test file changes?

  • Status changed to Needs review about 1 month ago
  • πŸ‡¨πŸ‡¦Canada dylan donkersgoed London, Ontario

    I've tested this in a relatively fresh Drupal install with groups and it seems to be working, at least in manual testing. I'm not moving it to RTBC for now because the automated tests seem to be failing. I'm not sure if that's actually cause for concern - they seem to fail in D10 before the changes from this issue as well, though with different errors.

    My Drupal install was set up as follows *before* installing the entitygroupfield module::

    • Groups is installed
    • One group type, "test" is setup
    • The default basic page content type is installed in this group
    • Group permissions are configured such that anyone can view content in the group and members can add/edit basic pages and add basic pages to groups
    • There is a "test public group" group
    • There is a "test page in public group" basic page instance assigned to this group"

    I tested the following as user 1:

    1. Adding the module via composer using a custom repo for this branch (added { "type": "vcs", "url": "git@git.drupal.org:issue/entitygroupfield-3515583.git" } to the repositories section of my composer.json, added "drupal/entitygroupfield": "dev-3515583-drupal-11-compatibility" to the require section, and then ran composer update)
    2. Installing the module
    3. Adding the basic page content type to groups
    4. Updating the basic page form display to show the entitygroupfield "Groups" field with widget "Group select" configured to be required
    5. Editing a node that already belonged to a group - the Groups field was populated as expected
    6. Adding a new node and assigning it to a group via the "Add new content" button on the group (as the group member) - it displays in the group admin interface as expected
    7. Edited this node, groups field is populated as expected
    8. Added same group member to another group
    9. Edited same node from before, group member was able to add additional groups as expected

    D11 automated tests report the following failures:

    There were 2 errors:

    1) Drupal\Tests\entitygroupfield\Kernel\GroupAutocompleteFormElementTest::testGroupAutocompleteNoGroups
    RuntimeException: Cannot compare markup between MarkupInterface objects and plain strings

    /app/web/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php:42
    /app/web/modules/contrib/entitygroupfield/tests/src/Kernel/GroupAutocompleteFormElementTest.php:110

    2) Drupal\Tests\entitygroupfield\Kernel\GroupAutocompleteFormElementTest::testGroupAutocomplete
    RuntimeException: Cannot compare markup between MarkupInterface objects and plain strings

    /app/web/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php:42
    /app/web/modules/contrib/entitygroupfield/tests/src/Kernel/GroupAutocompleteFormElementTest.php:163

    ERRORS!
    Tests: 4, Assertions: 140, Errors: 2, PHPUnit Deprecations: 9.

    The CI failures seem to be because it's using PHP 7.4, which is not compatible with Drupal 11. Why that is I'm not sure, but I don't think it's related to the changes from this issue.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 598s
    #555069
  • πŸ‡¨πŸ‡¦Canada dylan donkersgoed London, Ontario

    I pushed up a change to fix some issues causing the tests to fail due to some of the logic in the actual tests being deprecated: https://www.drupal.org/project/view_mode_switch/issues/3340835 πŸ“Œ Using assert[Not]Equals() to compare markup between MarkupInterface objects and plain strings is deprecated Fixed

    They now fail in the same way as tests do in D10. I'm not sure if it's appropriate for me to mark this as RTBC since I've made changes to the tests, but FWIW I'm satisfied it's working for Drupal 11 with these changes based on my testing above and the automated test results now matching the D10 test results.

    One of the tests, \Drupal\Tests\entitygroupfield\Kernel\GroupAutocompleteFormElementTest::testGroupAutcomplete is still failing with these errors, unrelated to the changes in the ticket:

    Time: 00:23.350, Memory: 14.00 MB

    There was 1 error:

    1) Drupal\Tests\entitygroupfield\Kernel\GroupAutocompleteFormElementTest::testGroupAutocomplete
    Drupal\Core\Entity\EntityStorageException: Could not assign role with ID ppd1fo48: Role belongs to a different group type.

    /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:815
    /app/web/modules/contrib/group/src/Entity/Group.php:147
    /app/web/modules/contrib/group/src/Entity/Group.php:183
    /app/web/modules/contrib/entitygroupfield/tests/src/Kernel/GroupAutocompleteFormElementTest.php:184

    Caused by
    Drupal\Core\Entity\EntityMalformedException: Could not assign role with ID ppd1fo48: Role belongs to a different group type.

    /app/web/modules/contrib/group/src/Entity/GroupMembershipTrait.php:31
    /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:529
    /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:760
    /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:484
    /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:804
    /app/web/modules/contrib/group/src/Entity/Group.php:147
    /app/web/modules/contrib/group/src/Entity/Group.php:183
    /app/web/modules/contrib/entitygroupfield/tests/src/Kernel/GroupAutocompleteFormElementTest.php:184

    ERRORS!
    Tests: 4, Assertions: 144, Errors: 1, PHPUnit Deprecations: 9.

Production build 0.71.5 2024