Move useful helper methods for working with entities from EntityKernelTestBase to a trait

Created on 19 July 2021, about 3 years ago
Updated 3 September 2024, about 1 month ago

Problem/Motivation

EntityKernelTestBase is a very useful test base class, as it provides a bunch of useful helper methods and does some work in setUp() which are not present in the parent class KernelTestBase. This makes it useful for any tests that cover any kind of entity-related code.

However, it enables the entity_test module, which is a test module which provides a huge list of entity types for testing. This is not always desirable in tests.

Steps to reproduce

Proposed resolution

Move useful helper methods for working with entities to the KernelTestBase class.

Other possibilities were:

a. Remove the 'entity_test' module from EntityKernelTestBase, and enable it in child classes that need it
b. Remove the 'entity_test' module from EntityKernelTestBase, and make a new child class of EntityKernelTestBase for test classes that need the module to inherit from
c. Provide a new parent class of EntityKernelTestBase which is more reusable

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.4 ✨

Component
PHPUnit  →

Last updated 1 day ago

Created by

🇬🇧United Kingdom joachim

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024