Fix tests that use node_add_body_field

Issue information

From user: jurgenhaas

Contribution record

Fork management

Problem/Motivation

Following the CR at #3516778: node_add_body_field() is deprecated the method node_add_body_field is deprecated. But not only that, still using it as suggested in the CR doesn't work as this is causing different errors like these:

Drupal\Tests\eca_form\Kernel\FormConditionsTest::testFormTriggered
Drupal\Core\Field\FieldException: Attempt to create a field without a field_name.
/builds/project/eca/web/core/modules/field/src/Entity/FieldConfig.php:126
/builds/project/eca/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:204
/builds/project/eca/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:232
/builds/project/eca/web/core/lib/Drupal/Core/Entity/EntityBase.php:548
/builds/project/eca/web/core/modules/node/node.module:158
/builds/project/eca/modules/form/tests/src/Kernel/FormConditionsTest.php:67

This is most likely because also the field storage of body has gone and needs to be created like in the newly available traits. But those traits are not available yet in current Drupal core tests.

Proposed resolution

As we're using that method a lot in ECA tests, let's copy those traits into our main test namespace until we canfully rely on their availability in core.

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information