- Issue created by @Chris Dart
- πΊπΈ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 9:04pm 22 July 2025 - π¨π¦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:
- 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 rancomposer update
) - Installing the module
- Adding the basic page content type to groups
- Updating the basic page form display to show the entitygroupfield "Groups" field with widget "Group select" configured to be required
- Editing a node that already belonged to a group - the Groups field was populated as expected
- 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
- Edited this node, groups field is populated as expected
- Added same group member to another group
- 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:1102) 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:163ERRORS!
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.
- π¨π¦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:184Caused 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:184ERRORS!
Tests: 4, Assertions: 144, Errors: 1, PHPUnit Deprecations: 9.