From 78bebf2b32f74c0fc92076f9fc43af5cdb836a4e Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Mon, 3 Feb 2025 18:14:36 +0000
Subject: [PATCH] Issue #3495966 by nikolay shapovalov, nicxvan, smustgrave,
 berdir: Deprecate and replace entity_test_create_bundle(),
 entity_test_delete_bundle()

---
 .../src/Functional/CommentCacheTagsTest.php   |  3 +-
 .../src/Functional/CommentNonNodeTest.php     |  7 ++--
 .../Rest/CommentResourceTestBase.php          |  3 +-
 .../Functional/ConfigTranslationCacheTest.php |  3 +-
 .../ConfigTranslationUiModulesTest.php        |  5 ++-
 .../src/Kernel/ContentModerationStateTest.php |  5 ++-
 .../EntityReference/Views/SelectionTest.php   |  3 +-
 .../field/tests/src/Functional/FormTest.php   |  3 +-
 .../src/Functional/MultipleWidgetFormTest.php |  3 +-
 .../field/tests/src/Kernel/BulkDeleteTest.php |  3 +-
 .../EntityReferenceSettingsTest.php           |  5 ++-
 .../EntityReference/Views/SelectionTest.php   |  3 +-
 .../src/Kernel/FieldAttachStorageTest.php     | 11 +++---
 .../field/tests/src/Kernel/FieldCrudTest.php  |  5 ++-
 .../src/Kernel/FieldImportChangeTest.php      |  3 +-
 .../src/Kernel/FieldImportCreateTest.php      |  3 +-
 .../src/Kernel/FieldImportDeleteTest.php      |  5 ++-
 .../EntityDisplayTest.php                     |  3 +-
 .../tests/src/Kernel/EntityDisplayTest.php    |  5 ++-
 .../tests/src/Functional/FileListingTest.php  |  3 +-
 .../tests/src/Functional/CommentTest.php      |  3 +-
 ...ollectionFilterAccessTestPatternsTrait.php |  3 +-
 .../LanguageConfigurationElementTest.php      |  5 ++-
 .../src/Kernel/DefaultsSectionStorageTest.php |  3 +-
 .../tests/src/Kernel/EntityViewAlterTest.php  |  3 +-
 .../tests/src/Kernel/InlineBlockUsageTest.php |  3 +-
 .../modules/entity_test/entity_test.module    | 25 +++++++-----
 .../entity_test/src/EntityTestHelper.php      | 39 +++++++++++++++++++
 .../entity_test/src/Hook/EntityTestHooks.php  |  3 ++
 .../src/Functional/Entity/EntityAddUITest.php |  7 ++--
 .../Entity/EntityCacheTagsTestBase.php        |  3 +-
 .../src/Kernel/TermEntityReferenceTest.php    |  3 +-
 .../Handler/ComputedBundleFieldTest.php       |  7 ++--
 .../src/Kernel/Handler/FieldFieldTest.php     |  5 ++-
 .../Theme/ClaroEntityDisplayTest.php          |  3 +-
 .../Core/Entity/BundleClassTest.php           | 17 ++++----
 .../Core/Entity/EntityBundleFieldTest.php     |  6 ++-
 .../Core/Entity/EntityBundleListenerTest.php  |  4 +-
 .../Entity/EntityDefinitionUpdateTest.php     |  5 ++-
 .../Core/Entity/EntityDeriverTest.php         |  5 ++-
 .../Core/Entity/EntityFieldTest.php           |  4 +-
 .../Entity/EntityQueryRelationshipTest.php    |  3 +-
 .../Core/Entity/EntityQueryTest.php           |  7 ++--
 .../Core/Entity/EntityReferenceFieldTest.php  |  3 +-
 .../Core/Entity/EntityViewHookTest.php        |  3 +-
 .../ParamConverter/EntityConverterTest.php    |  7 ++--
 46 files changed, 177 insertions(+), 86 deletions(-)

diff --git a/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php b/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
index 32f265dc7592..ff767049a7a3 100644
--- a/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\Tests\system\Functional\Entity\EntityWithUriCacheTagsTestBase;
 use Drupal\user\Entity\Role;
@@ -66,7 +67,7 @@ protected function setUp(): void {
   protected function createEntity() {
     // Create a "bar" bundle for the "entity_test" entity type and create.
     $bundle = 'bar';
-    entity_test_create_bundle($bundle, NULL, 'entity_test');
+    EntityTestHelper::createBundle($bundle, NULL, 'entity_test');
 
     // Create a comment field on this bundle.
     $this->addDefaultCommentField('entity_test', 'bar', 'comment');
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index ebee837f4de5..2a11aeb3d1e8 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -10,6 +10,7 @@
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
 use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\Tests\BrowserTestBase;
@@ -66,7 +67,7 @@ protected function setUp(): void {
     $this->drupalPlaceBlock('page_title_block');
 
     // Create a bundle for entity_test.
-    entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test');
+    EntityTestHelper::createBundle('entity_test', 'Entity Test', 'entity_test');
     CommentType::create([
       'id' => 'comment',
       'label' => 'Comment settings',
@@ -495,7 +496,7 @@ public function testCommentFunctionality(): void {
    */
   public function testsNonIntegerIdEntities(): void {
     // Create a bundle for entity_test_string_id.
-    entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test_string_id');
+    EntityTestHelper::createBundle('entity_test', 'Entity Test', 'entity_test_string_id');
     $limited_user = $this->drupalCreateUser([
       'administer entity_test_string_id fields',
       'administer comment types',
@@ -514,7 +515,7 @@ public function testsNonIntegerIdEntities(): void {
     $this->assertSession()->responseNotContains('Test entity with string_id');
 
     // Create a bundle for entity_test_no_id.
-    entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test_no_id');
+    EntityTestHelper::createBundle('entity_test', 'Entity Test', 'entity_test_no_id');
     $this->drupalLogin($this->drupalCreateUser([
       'administer entity_test_no_id fields',
     ]));
diff --git a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
index 974c0f68f1da..17265934fdbc 100644
--- a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
+++ b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
@@ -10,6 +10,7 @@
 use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Cache\Cache;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
 use Drupal\user\Entity\User;
 use GuzzleHttp\RequestOptions;
@@ -99,7 +100,7 @@ protected function setUpAuthorization($method) {
   protected function createEntity() {
     // Create a "bar" bundle for the "entity_test" entity type and create.
     $bundle = 'bar';
-    entity_test_create_bundle($bundle, NULL, 'entity_test');
+    EntityTestHelper::createBundle($bundle, NULL, 'entity_test');
 
     // Create a comment field on this bundle.
     $this->addDefaultCommentField('entity_test', 'bar', 'comment');
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
index 5db3d0797cba..6927ac6f3ef9 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\Tests\config_translation\Functional;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\filter\Entity\FilterFormat;
@@ -134,7 +135,7 @@ public function testFieldConfigTranslation(): void {
     $field_storage->save();
 
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
     $field = FieldConfig::create([
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiModulesTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiModulesTest.php
index 0c0b18377bda..ccf0475d1312 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiModulesTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiModulesTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Language\Language;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\node\Entity\NodeType;
@@ -221,7 +222,7 @@ public function testFieldConfigTranslation(): void {
     $field_storage->save();
 
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
     $field = FieldConfig::create([
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -256,7 +257,7 @@ public function testBooleanFieldConfigTranslation(): void {
     ])->save();
 
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
     $field = FieldConfig::create([
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
index 2c8fe2ef91f3..9f61a70746a1 100644
--- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
+++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\State\StateInterface;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\node\Entity\Node;
@@ -682,7 +683,7 @@ public function testWorkflowDependencies(): void {
    */
   public function testWorkflowNonConfigBundleDependencies(): void {
     // Create a bundle not based on any particular configuration.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     $workflow = $this->createEditorialWorkflow();
     $workflow->getTypePlugin()->addEntityTypeAndBundle('entity_test', 'test_bundle');
@@ -701,7 +702,7 @@ public function testWorkflowNonConfigBundleDependencies(): void {
 
     // Delete the test bundle to ensure the workflow entity responds
     // appropriately.
-    entity_test_delete_bundle('test_bundle');
+    EntityTestHelper::deleteBundle('test_bundle');
 
     $workflow = Workflow::load('editorial');
     $this->assertEquals([], $workflow->getTypePlugin()->getBundlesForEntityType('entity_test'));
diff --git a/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php b/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php
index d0a167608dd6..3ff3dd99d334 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php
@@ -8,6 +8,7 @@
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Site\Settings;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\BrowserTestBase;
 use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
 use Drupal\views\Views;
@@ -70,7 +71,7 @@ protected function setUp(): void {
 
     // Ensure the bundle to which the field is attached actually exists, or we
     // will get config validation errors.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     // Create an entity reference field.
     $handler_settings = [
diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php
index ac3118f96931..f88acfe0647e 100644
--- a/core/modules/field/tests/src/Functional/FormTest.php
+++ b/core/modules/field/tests/src/Functional/FormTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Form\FormState;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestBaseFieldDisplay;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -598,7 +599,7 @@ public function testLabelOnMultiValueFields(): void {
     $this->drupalLogin($user);
 
     // Ensure that the 'bar' bundle exists, to avoid config validation errors.
-    entity_test_create_bundle('bar', entity_type: 'entity_test_base_field_display');
+    EntityTestHelper::createBundle('bar', entity_type: 'entity_test_base_field_display');
 
     FieldStorageConfig::create([
       'entity_type' => 'entity_test_base_field_display',
diff --git a/core/modules/field/tests/src/Functional/MultipleWidgetFormTest.php b/core/modules/field/tests/src/Functional/MultipleWidgetFormTest.php
index 8674ce0d96c4..c58de4cedabe 100644
--- a/core/modules/field/tests/src/Functional/MultipleWidgetFormTest.php
+++ b/core/modules/field/tests/src/Functional/MultipleWidgetFormTest.php
@@ -7,6 +7,7 @@
 use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestBaseFieldDisplay;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -147,7 +148,7 @@ public function testLabelOnMultiValueFields(): void {
     $this->drupalLogin($user);
 
     // Ensure that the 'bar' bundle exists, to avoid config validation errors.
-    entity_test_create_bundle('bar', entity_type: 'entity_test_base_field_display');
+    EntityTestHelper::createBundle('bar', entity_type: 'entity_test_base_field_display');
 
     FieldStorageConfig::create([
       'entity_type' => 'entity_test_base_field_display',
diff --git a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
index 86d1db95e4c7..5ed14a4af816 100644
--- a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\Database\Database;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field_test\FieldTestHelper;
@@ -105,7 +106,7 @@ protected function setUp(): void {
     // Create two bundles.
     $this->bundles = ['bb_1' => 'bb_1', 'bb_2' => 'bb_2'];
     foreach ($this->bundles as $name => $desc) {
-      entity_test_create_bundle($name, $desc);
+      EntityTestHelper::createBundle($name, $desc);
     }
 
     // Create two field storages.
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
index c169811a71bf..b74ce296bf93 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Logger\RfcLogLevel;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\node\Entity\NodeType;
 use Drupal\KernelTests\KernelTestBase;
@@ -81,7 +82,7 @@ protected function setUp(): void {
 
     // Create a custom bundle.
     $this->customBundle = 'test_bundle_' . $this->randomMachineName();
-    entity_test_create_bundle($this->customBundle, NULL, 'entity_test');
+    EntityTestHelper::createBundle($this->customBundle, NULL, 'entity_test');
 
     // Prepare the logger for collecting the expected critical error.
     $this->container->get($this->testLogServiceName)->cleanLogs();
@@ -163,7 +164,7 @@ public function testCustomTargetBundleDeletion(): void {
     $this->assertEquals($handler_settings, $actual_handler_settings);
 
     // Delete the custom bundle.
-    entity_test_delete_bundle($this->customBundle, 'entity_test');
+    EntityTestHelper::deleteBundle($this->customBundle, 'entity_test');
 
     // Ensure that field_field_config_presave() logs the expected critical
     // error.
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php b/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php
index 5ea5bf7fd0e1..43016b77fbe9 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Component\Render\MarkupInterface;
 use Drupal\Component\Utility\Html;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\NodeType;
@@ -78,7 +79,7 @@ protected function setUp(): void {
 
     // Ensure the bundle to which the field is attached actually exists, or we
     // will get config validation errors.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     // Create an entity reference field.
     $handler_settings = [
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index 347148ee4f8e..9d6c428cf57a 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\Tests\field\Kernel;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field_test\FieldTestHelper;
@@ -87,8 +88,8 @@ public function testFieldAttachLoadMultiple(): void {
       1 => 'test_bundle_1',
       2 => 'test_bundle_2',
     ];
-    entity_test_create_bundle($bundles[1], entity_type: $entity_type);
-    entity_test_create_bundle($bundles[2], entity_type: $entity_type);
+    EntityTestHelper::createBundle($bundles[1], entity_type: $entity_type);
+    EntityTestHelper::createBundle($bundles[2], entity_type: $entity_type);
     // Define 3 fields:
     // - field_1 is in bundle_1 and bundle_2,
     // - field_2 is in bundle_1,
@@ -299,7 +300,7 @@ public function testEntityCreateBundle(): void {
 
     // Create a new bundle.
     $new_bundle = 'test_bundle_' . $this->randomMachineName();
-    entity_test_create_bundle($new_bundle, NULL, $entity_type);
+    EntityTestHelper::createBundle($new_bundle, NULL, $entity_type);
 
     // Add a field to that bundle.
     $this->fieldTestData->field_definition['bundle'] = $new_bundle;
@@ -326,7 +327,7 @@ public function testEntityDeleteBundle(): void {
 
     // Create a new bundle.
     $new_bundle = 'test_bundle_' . $this->randomMachineName();
-    entity_test_create_bundle($new_bundle, NULL, $entity_type);
+    EntityTestHelper::createBundle($new_bundle, NULL, $entity_type);
 
     // Add a field to that bundle.
     $this->fieldTestData->field_definition['bundle'] = $new_bundle;
@@ -370,7 +371,7 @@ public function testEntityDeleteBundle(): void {
     $this->container->get('entity_display.repository')
       ->getFormDisplay($entity_type, $this->fieldTestData->field->getTargetBundle())
       ->delete();
-    entity_test_delete_bundle($this->fieldTestData->field->getTargetBundle(), $entity_type);
+    EntityTestHelper::deleteBundle($this->fieldTestData->field->getTargetBundle(), $entity_type);
 
     // Verify no data gets loaded
     $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId());
diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
index 6ad21b723f21..e51a2db9d6e8 100644
--- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
@@ -7,6 +7,7 @@
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\Core\Field\FieldException;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldConfig;
 
@@ -284,7 +285,7 @@ public function testDeleteFieldNoData(): void {
     FieldConfig::create($this->fieldDefinition)->save();
     $another_field_definition = $this->fieldDefinition;
     $another_field_definition['bundle'] .= '_another_bundle';
-    entity_test_create_bundle($another_field_definition['bundle']);
+    EntityTestHelper::createBundle($another_field_definition['bundle']);
     FieldConfig::create($another_field_definition)->save();
 
     // Test that the first field is not deleted, and then delete it.
@@ -312,7 +313,7 @@ public function testDeleteFieldNoData(): void {
   public function testDeleteFieldCrossDeletion(): void {
     $field_definition_2 = $this->fieldDefinition;
     $field_definition_2['bundle'] .= '_another_bundle';
-    entity_test_create_bundle($field_definition_2['bundle']);
+    EntityTestHelper::createBundle($field_definition_2['bundle']);
 
     // Check that deletion of a field storage deletes its fields.
     $field_storage = $this->fieldStorage;
diff --git a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
index 5f2b45bfdcaa..4d5be54dffab 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\Tests\field\Kernel;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 
 /**
@@ -28,7 +29,7 @@ class FieldImportChangeTest extends FieldKernelTestBase {
    * Tests importing an updated field.
    */
   public function testImportChange(): void {
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     $this->installConfig(['field_test_config']);
     $field_storage_id = 'field_test_import';
diff --git a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
index 4848a29a0762..73900f28d310 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\field\Kernel;
 
 use Drupal\Core\Site\Settings;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -35,7 +36,7 @@ public function testImportCreateDefault(): void {
     $this->assertNull(FieldConfig::load($field_id_2b));
 
     // Create a second bundle for the 'Entity test' entity type.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     // Enable field_test_config module and check that the field and storage
     // shipped in the module's default config were created.
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index 5965923b6b86..77c6f946873e 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\field\Kernel;
 
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -30,7 +31,7 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
    * Tests deleting field storages and fields as part of config import.
    */
   public function testImportDelete(): void {
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     $this->installConfig(['field_test_config']);
     // At this point there are 5 field configuration objects in the active
@@ -63,7 +64,7 @@ public function testImportDelete(): void {
     $entity_test->save();
 
     // Create a second bundle for the 'Entity test' entity type.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
 
     // Get the uuid's for the field storages.
     $field_storage_uuid = FieldStorageConfig::load($field_storage_id)->uuid();
diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
index 0ef7b33165c6..fa6cee742617 100644
--- a/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\field_ui\FunctionalJavascript;
 
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
 
 /**
@@ -98,7 +99,7 @@ public function testEntityView(): void {
    * Tests extra fields.
    */
   public function testExtraFields(): void {
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $this->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
     $this->assertSession()->waitForElement('css', '.tabledrag-handle');
     $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 9114e95e1179..0608df798cc6 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\Core\Entity\Entity\EntityViewMode;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\node\Entity\NodeType;
@@ -174,7 +175,7 @@ public function testEntityGetDisplay(): void {
    * Tests the behavior of a field component within an entity display object.
    */
   public function testExtraFieldComponent(): void {
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $display = EntityViewDisplay::create([
       'targetEntityType' => 'entity_test',
       'bundle' => 'bundle_with_extra_fields',
@@ -197,7 +198,7 @@ public function testExtraFieldComponent(): void {
    * Tests the behavior of an extra field component with initial invalid values.
    */
   public function testExtraFieldComponentInitialInvalidConfig(): void {
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $display = EntityViewDisplay::create([
       'targetEntityType' => 'entity_test',
       'bundle' => 'bundle_with_extra_fields',
diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php
index 08b5c7cc6ad5..45e3c4be32c7 100644
--- a/core/modules/file/tests/src/Functional/FileListingTest.php
+++ b/core/modules/file/tests/src/Functional/FileListingTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\file\Functional;
 
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\node\Entity\Node;
 use Drupal\file\Entity\File;
 use Drupal\entity_test\Entity\EntityTestConstraints;
@@ -215,7 +216,7 @@ public function testFileListingUsageNoLink(): void {
 
     // Create a bundle and attach a File field to the bundle.
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle, NULL, 'entity_test_constraints');
+    EntityTestHelper::createBundle($bundle, NULL, 'entity_test_constraints');
     $this->createFileField('field_test_file', 'entity_test_constraints', $bundle, [], ['file_extensions' => 'txt png']);
 
     // Create file to attach to entity.
diff --git a/core/modules/jsonapi/tests/src/Functional/CommentTest.php b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
index 6396330801cd..d497a2de158f 100644
--- a/core/modules/jsonapi/tests/src/Functional/CommentTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\Tests\jsonapi\Functional;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\jsonapi\JsonApiSpec;
 use Drupal\comment\Entity\Comment;
 use Drupal\comment\Entity\CommentType;
@@ -108,7 +109,7 @@ protected function setUpAuthorization($method): void {
   protected function createEntity() {
     // Create a "bar" bundle for the "entity_test" entity type and create.
     $bundle = 'bar';
-    entity_test_create_bundle($bundle, NULL, 'entity_test');
+    EntityTestHelper::createBundle($bundle, NULL, 'entity_test');
 
     // Create a comment field on this bundle.
     $this->addDefaultCommentField('entity_test', 'bar', 'comment');
diff --git a/core/modules/jsonapi/tests/src/Traits/CommonCollectionFilterAccessTestPatternsTrait.php b/core/modules/jsonapi/tests/src/Traits/CommonCollectionFilterAccessTestPatternsTrait.php
index 675b7260ce99..cd68a897911f 100644
--- a/core/modules/jsonapi/tests/src/Traits/CommonCollectionFilterAccessTestPatternsTrait.php
+++ b/core/modules/jsonapi/tests/src/Traits/CommonCollectionFilterAccessTestPatternsTrait.php
@@ -9,6 +9,7 @@
 use Drupal\Core\Entity\EntityPublishedInterface;
 use Drupal\Core\Url;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
 use Drupal\Tests\jsonapi\Functional\ResourceTestBase;
 use GuzzleHttp\RequestOptions;
@@ -36,7 +37,7 @@ public function doTestCollectionFilterAccessBasedOnPermissions($label_field_name
 
     // Set up data model.
     $this->assertTrue($this->container->get('module_installer')->install(['entity_test'], TRUE), 'Installed modules.');
-    entity_test_create_bundle('bar', NULL, 'entity_test');
+    EntityTestHelper::createBundle('bar', NULL, 'entity_test');
     $this->createEntityReferenceField(
       'entity_test',
       'bar',
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
index 2d5b87e7ae7b..178e4828b58d 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\language\Functional;
 
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\language\Entity\ContentLanguageSettings;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -107,8 +108,8 @@ public function testDefaultLangcode(): void {
     }
 
     // Ensure the bundles under test exist, to avoid config validation errors.
-    entity_test_create_bundle('custom_bundle');
-    entity_test_create_bundle('some_bundle');
+    EntityTestHelper::createBundle('custom_bundle');
+    EntityTestHelper::createBundle('some_bundle');
 
     // Fixed language.
     ContentLanguageSettings::loadByEntityTypeBundle('entity_test', 'custom_bundle')
diff --git a/core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php b/core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php
index 18ff5572a76b..695429b09f84 100644
--- a/core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php
+++ b/core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php
@@ -9,6 +9,7 @@
 use Drupal\Core\Plugin\Context\EntityContext;
 use Drupal\Core\Plugin\Context\EntityContextDefinition;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
 use Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage;
@@ -49,7 +50,7 @@ class DefaultsSectionStorageTest extends KernelTestBase {
   protected function setUp(): void {
     parent::setUp();
 
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $this->installEntitySchema('entity_test');
     $this->installEntitySchema('user');
     $this->installConfig(['layout_builder_defaults_test']);
diff --git a/core/modules/layout_builder/tests/src/Kernel/EntityViewAlterTest.php b/core/modules/layout_builder/tests/src/Kernel/EntityViewAlterTest.php
index 25ff02257679..e66872a1ddbd 100644
--- a/core/modules/layout_builder/tests/src/Kernel/EntityViewAlterTest.php
+++ b/core/modules/layout_builder/tests/src/Kernel/EntityViewAlterTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\Routing\RouteObjectInterface;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
 use Symfony\Component\HttpFoundation\Request;
@@ -37,7 +38,7 @@ class EntityViewAlterTest extends KernelTestBase {
    */
   protected function setUp(): void {
     parent::setUp();
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $this->installEntitySchema('entity_test');
     $this->installConfig(['layout_builder_defaults_test']);
   }
diff --git a/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php b/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php
index b955941ef672..fd2d93945d19 100644
--- a/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php
+++ b/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\Database\Connection;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\layout_builder\InlineBlockUsageInterface;
 
@@ -48,7 +49,7 @@ protected function setUp(): void {
     $this->database = $this->container->get('database');
     $this->inlineBlockUsage = $this->container->get('inline_block.usage');
     $this->installSchema('layout_builder', ['inline_block_usage']);
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $this->installEntitySchema('entity_test');
     $this->entity = EntityTest::create();
     $this->entity->save();
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index 66667dfd7253..30e55b6145e2 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -10,6 +10,7 @@
 use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\entity_test\EntityTestHelper;
 
 /**
  * Creates a new bundle for entity_test entities.
@@ -22,13 +23,15 @@
  * @param string $entity_type
  *   (optional) The entity type for which the bundle is created. Defaults to
  *   'entity_test'.
+ *
+ * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use
+ *   \Drupal\entity_test\EntityTestHelper::createBundle() instead.
+ *
+ * @see https://www.drupal.org/node/3497049
  */
 function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity_test') {
-  $bundles = \Drupal::state()->get($entity_type . '.bundles', [$entity_type => ['label' => 'Entity Test Bundle']]);
-  $bundles += [$bundle => ['label' => $text ? $text : $bundle]];
-  \Drupal::state()->set($entity_type . '.bundles', $bundles);
-
-  \Drupal::service('entity_bundle.listener')->onBundleCreate($bundle, $entity_type);
+  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal\entity_test\EntityTestHelper::createBundle() instead. See https://www.drupal.org/node/3497049', E_USER_DEPRECATED);
+  EntityTestHelper::createBundle($bundle, $text, $entity_type);
 }
 
 /**
@@ -39,13 +42,15 @@ function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity
  * @param string $entity_type
  *   (optional) The entity type for which the bundle is deleted. Defaults to
  *   'entity_test'.
+ *
+ * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use
+ *    \Drupal\entity_test\EntityTestHelper::deleteBundle() instead.
+ *
+ * @see https://www.drupal.org/node/3497049
  */
 function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') {
-  $bundles = \Drupal::state()->get($entity_type . '.bundles', [$entity_type => ['label' => 'Entity Test Bundle']]);
-  unset($bundles[$bundle]);
-  \Drupal::state()->set($entity_type . '.bundles', $bundles);
-
-  \Drupal::service('entity_bundle.listener')->onBundleDelete($bundle, $entity_type);
+  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal\entity_test\EntityTestHelper::deleteBundle() instead. See https://www.drupal.org/node/3497049', E_USER_DEPRECATED);
+  EntityTestHelper::deleteBundle($bundle, $entity_type);
 }
 
 /**
diff --git a/core/modules/system/tests/modules/entity_test/src/EntityTestHelper.php b/core/modules/system/tests/modules/entity_test/src/EntityTestHelper.php
index 1cc35789e19c..1a99b320d1b0 100644
--- a/core/modules/system/tests/modules/entity_test/src/EntityTestHelper.php
+++ b/core/modules/system/tests/modules/entity_test/src/EntityTestHelper.php
@@ -54,4 +54,43 @@ public static function getEntityTypes($filter = NULL): array {
     return array_combine($types, $types);
   }
 
+  /**
+   * Creates a new bundle for entity_test entities.
+   *
+   * @param string $bundle
+   *   The machine-readable name of the bundle.
+   * @param string $text
+   *   (optional) The human-readable name of the bundle. If none is provided, the
+   *   machine name will be used.
+   * @param string $entity_type
+   *   (optional) The entity type for which the bundle is created. Defaults to
+   *   'entity_test'.
+   *
+   * @see \Drupal\entity_test\Hook\EntityTestHooks::entityBundleInfo()
+   */
+  public static function createBundle($bundle, $text = NULL, $entity_type = 'entity_test'): void {
+    $bundles = \Drupal::state()->get($entity_type . '.bundles', [$entity_type => ['label' => 'Entity Test Bundle']]);
+    $bundles += [$bundle => ['label' => $text ? $text : $bundle]];
+    \Drupal::state()->set($entity_type . '.bundles', $bundles);
+    \Drupal::service('entity_bundle.listener')->onBundleCreate($bundle, $entity_type);
+  }
+
+  /**
+   * Deletes a bundle for entity_test entities.
+   *
+   * @param string $bundle
+   *   The machine-readable name of the bundle to delete.
+   * @param string $entity_type
+   *   (optional) The entity type for which the bundle is deleted. Defaults to
+   *   'entity_test'.
+   *
+   * @see \Drupal\entity_test\Hook\EntityTestHooks::entityBundleInfo()
+   */
+  public static function deleteBundle($bundle, $entity_type = 'entity_test'): void {
+    $bundles = \Drupal::state()->get($entity_type . '.bundles', [$entity_type => ['label' => 'Entity Test Bundle']]);
+    unset($bundles[$bundle]);
+    \Drupal::state()->set($entity_type . '.bundles', $bundles);
+    \Drupal::service('entity_bundle.listener')->onBundleDelete($bundle, $entity_type);
+  }
+
 }
diff --git a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
index d827a57d4d71..268a12435ac3 100644
--- a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
+++ b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
@@ -124,6 +124,9 @@ public function entityBaseFieldInfoAlter(&$fields, EntityTypeInterface $entity_t
 
   /**
    * Implements hook_entity_bundle_info().
+   *
+   * @see \Drupal\entity_test\EntityTestHelper::createBundle()
+   * @see \Drupal\entity_test\EntityTestHelper::deleteBundle()
    */
   #[Hook('entity_bundle_info')]
   public function entityBundleInfo(): array {
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php b/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
index 0728dc112d07..77eaa48575b0 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
@@ -7,6 +7,7 @@
 use Drupal\entity_test\Entity\EntityTestBundle;
 use Drupal\entity_test\Entity\EntityTestMul;
 use Drupal\entity_test\Entity\EntityTestWithBundle;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\BrowserTestBase;
 
 /**
@@ -142,7 +143,7 @@ public function testAddPageWithoutBundleEntities(): void {
     ]);
     $this->drupalLogin($admin_user);
 
-    entity_test_create_bundle('test', 'Test label', 'entity_test_mul');
+    EntityTestHelper::createBundle('test', 'Test label', 'entity_test_mul');
     // Delete the default bundle, so that we can rely on our own. The form
     // display has to be deleted first to prevent schema errors when fields
     // attached to the deleted bundle are themselves deleted, which triggers
@@ -150,14 +151,14 @@ public function testAddPageWithoutBundleEntities(): void {
     $this->container->get('entity_display.repository')
       ->getFormDisplay('entity_test_mul', 'entity_test_mul')
       ->delete();
-    entity_test_delete_bundle('entity_test_mul', 'entity_test_mul');
+    EntityTestHelper::deleteBundle('entity_test_mul', 'entity_test_mul');
 
     // One bundle exists, confirm redirection to the add-form.
     $this->drupalGet('/entity_test_mul/add');
     $this->assertSession()->addressEquals('/entity_test_mul/add/test');
 
     // Two bundles exist, confirm both are shown.
-    entity_test_create_bundle('test2', 'Test2 label', 'entity_test_mul');
+    EntityTestHelper::createBundle('test2', 'Test2 label', 'entity_test_mul');
     $this->drupalGet('/entity_test_mul/add');
 
     $this->assertSession()->linkExists('Test label');
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
index e33685ce8035..9bd5c97bec8e 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Url;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase;
@@ -220,7 +221,7 @@ protected function createReferenceTestEntities($referenced_entity) {
 
     // Create a "foo" bundle for the given entity type.
     $bundle = 'foo';
-    entity_test_create_bundle($bundle, NULL, $entity_type);
+    EntityTestHelper::createBundle($bundle, NULL, $entity_type);
 
     // Add a field of the given type to the given entity type's "foo" bundle.
     $field_name = $referenced_entity->getEntityTypeId() . '_reference';
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php b/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php
index ab302e6b419d..160465227f1b 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\Tests\taxonomy\Kernel;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\KernelTests\KernelTestBase;
@@ -85,7 +86,7 @@ public function testSelectionTestVocabularyRestriction(): void {
     ]);
     $field_storage->save();
 
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
     $field = FieldConfig::create([
       'field_storage' => $field_storage,
       'entity_type' => 'entity_test',
diff --git a/core/modules/views/tests/src/Kernel/Handler/ComputedBundleFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/ComputedBundleFieldTest.php
index 2fff6735ae09..4153923a3ebe 100644
--- a/core/modules/views/tests/src/Kernel/Handler/ComputedBundleFieldTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/ComputedBundleFieldTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\views\Kernel\Handler;
 
 use Drupal\entity_test\Entity\EntityTestComputedBundleField;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\views\Views;
@@ -39,13 +40,13 @@ protected function setUp($import_test_views = TRUE): void {
     $this->installEntitySchema('entity_test_comp_bund_fld');
 
     // Create a default bundle that has a computed field.
-    entity_test_create_bundle('entity_test_comp_bund_fld_bund', NULL, 'entity_test_comp_bund_fld');
+    EntityTestHelper::createBundle('entity_test_comp_bund_fld_bund', NULL, 'entity_test_comp_bund_fld');
 
     // Create a second bundle that also has a computed field.
-    entity_test_create_bundle('entity_test_comp_bund_fld_bund_2', NULL, 'entity_test_comp_bund_fld');
+    EntityTestHelper::createBundle('entity_test_comp_bund_fld_bund_2', NULL, 'entity_test_comp_bund_fld');
 
     // Create a bundle that does not have the computed field.
-    entity_test_create_bundle('entity_test_bundle_no_comp_field', NULL, 'entity_test_comp_bund_fld');
+    EntityTestHelper::createBundle('entity_test_bundle_no_comp_field', NULL, 'entity_test_comp_bund_fld');
 
     ViewTestData::createTestViews(static::class, ['views_test_config']);
 
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
index bb07cf3453cc..bc694363c181 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
@@ -7,6 +7,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestRev;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\Tests\user\Traits\UserCreationTrait;
@@ -583,7 +584,7 @@ public function testRevisionComplexRender(): void {
   public function testMissingBundleFieldRender(): void {
     // Create a new bundle not having the test field attached.
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
 
     $entity = EntityTest::create([
       'type' => $bundle,
@@ -603,7 +604,7 @@ public function testMissingBundleFieldRender(): void {
    */
   public function testGetValueMethod(): void {
     $bundle = 'test_bundle';
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
 
     $field_multiple = FieldConfig::create([
       'field_name' => 'field_test_multiple',
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
index 8108ab538ecb..85476468d815 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\FunctionalJavascriptTests\Theme;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest;
 
 /**
@@ -96,7 +97,7 @@ public function testEntityView(): void {
    * with a line changed to reflect Claro's tabledrag selector.
    */
   public function testExtraFields(): void {
-    entity_test_create_bundle('bundle_with_extra_fields');
+    EntityTestHelper::createBundle('bundle_with_extra_fields');
     $this->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
     $this->assertSession()->waitForElement('css', '.tabledrag-handle');
     $id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php
index 635eb3550a83..a6dde2a705de 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\Exception\BundleClassInheritanceException;
 use Drupal\Core\Entity\Exception\MissingBundleClassException;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\entity_test_bundle_class\Entity\EntityTestAmbiguousBundleClass;
 use Drupal\entity_test_bundle_class\Entity\EntityTestBundleClass;
 use Drupal\entity_test_bundle_class\Entity\EntityTestUserClass;
@@ -47,7 +48,7 @@ protected function setUp(): void {
    * Tests making use of a custom bundle class.
    */
   public function testEntitySubclass(): void {
-    entity_test_create_bundle('bundle_class');
+    EntityTestHelper::createBundle('bundle_class');
 
     // Ensure we start life with empty counters.
     $this->assertEquals(0, EntityTestBundleClass::$preCreateCount);
@@ -131,7 +132,7 @@ public function testEntitySubclass(): void {
     $this->assertEquals(5, EntityTestBundleClass::$preCreateCount);
 
     // Make another bundle that does not have a bundle subclass.
-    entity_test_create_bundle('entity_test');
+    EntityTestHelper::createBundle('entity_test');
 
     $entity_test_1 = $this->storage->create(['type' => 'entity_test']);
     $entity_test_1->save();
@@ -223,8 +224,8 @@ public function testEntityNoBundleSubclass(): void {
   public function testAmbiguousBundleClassExceptionCreate(): void {
     $this->container->get('state')->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE);
     $this->entityTypeManager->clearCachedDefinitions();
-    entity_test_create_bundle('bundle_class');
-    entity_test_create_bundle('bundle_class_2');
+    EntityTestHelper::createBundle('bundle_class');
+    EntityTestHelper::createBundle('bundle_class_2');
 
     // Since we now have two bundles trying to reuse the same class, we expect
     // this to throw an exception.
@@ -239,8 +240,8 @@ public function testAmbiguousBundleClassExceptionCreate(): void {
    */
   public function testAmbiguousBundleClassExceptionEntityTypeRepository(): void {
     $this->container->get('state')->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE);
-    entity_test_create_bundle('entity_test_no_label');
-    entity_test_create_bundle('entity_test_no_label', NULL, 'entity_test_no_label');
+    EntityTestHelper::createBundle('entity_test_no_label');
+    EntityTestHelper::createBundle('entity_test_no_label', NULL, 'entity_test_no_label');
     // Now that we have an entity bundle class that's shared by two entirely
     // different entity types, we expect an exception to be thrown.
     $this->expectException(AmbiguousBundleClassException::class);
@@ -266,7 +267,7 @@ public function testBundleClassShouldExtendEntityClass(): void {
     $this->container->get('state')->set('entity_test_bundle_class_non_inheriting', TRUE);
     $this->entityTypeManager->clearCachedDefinitions();
     $this->expectException(BundleClassInheritanceException::class);
-    entity_test_create_bundle('bundle_class');
+    EntityTestHelper::createBundle('bundle_class');
     $this->storage->create(['type' => 'bundle_class']);
   }
 
@@ -277,7 +278,7 @@ public function testBundleClassShouldExist(): void {
     $this->container->get('state')->set('entity_test_bundle_class_does_not_exist', TRUE);
     $this->entityTypeManager->clearCachedDefinitions();
     $this->expectException(MissingBundleClassException::class);
-    entity_test_create_bundle('bundle_class');
+    EntityTestHelper::createBundle('bundle_class');
     $this->storage->create(['type' => 'bundle_class']);
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
index 42514a0f67fb..d7c74191db07 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
@@ -4,6 +4,8 @@
 
 namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\entity_test\EntityTestHelper;
+
 /**
  * Tests adding a custom bundle field.
  *
@@ -45,7 +47,7 @@ protected function setUp(): void {
    * Tests making use of a custom bundle field.
    */
   public function testCustomBundleFieldUsage(): void {
-    entity_test_create_bundle('custom', NULL, 'entity_test_update');
+    EntityTestHelper::createBundle('custom', NULL, 'entity_test_update');
 
     // Check that an entity with bundle entity_test does not have the custom
     // field.
@@ -92,7 +94,7 @@ public function testCustomBundleFieldUsage(): void {
     // bundle is deleted.
     $entity = $storage->create(['type' => 'custom', 'custom_bundle_field' => 'new']);
     $entity->save();
-    entity_test_delete_bundle('custom', 'entity_test_update');
+    EntityTestHelper::deleteBundle('custom', 'entity_test_update');
 
     $table = $table_mapping->getDedicatedDataTableName($entity->getFieldDefinition('custom_bundle_field')->getFieldStorageDefinition(), TRUE);
     $result = $this->database->select($table, 'f')
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php
index 9e87ad7d52b6..8b6297374c41 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php
@@ -4,6 +4,8 @@
 
 namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\entity_test\EntityTestHelper;
+
 /**
  * @coversDefaultClass \Drupal\Core\Entity\EntityBundleListener
  *
@@ -27,7 +29,7 @@ public function testOnBundleCreate(): void {
     ];
     $this->assertEquals($expected, $field_map['entity_test']['id']['bundles']);
 
-    entity_test_create_bundle('custom');
+    EntityTestHelper::createBundle('custom');
     $field_map = $this->container->get('entity_field.manager')->getFieldMap();
     $expected = [
       'entity_test' => 'entity_test',
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
index a428509dfe58..0088e81964f0 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
@@ -17,6 +17,7 @@
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\entity_test\FieldStorageDefinition;
 use Drupal\entity_test_update\Entity\EntityTestUpdate;
 use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait;
@@ -534,7 +535,7 @@ public function testBundleFieldDeleteWithExistingData(): void {
     $this->assertTrue($schema_handler->tableExists($dedicated_table_name), 'The bundle field uses a dedicated table.');
 
     // Save an entity with the bundle field populated.
-    entity_test_create_bundle('custom');
+    EntityTestHelper::createBundle('custom');
     $entity = $storage->create(['type' => 'test_bundle', 'new_bundle_field' => 'foo']);
     $entity->save();
 
@@ -620,7 +621,7 @@ public function testBundleFieldUpdateWithExistingData(): void {
     $this->applyEntityUpdates();
 
     // Save an entity with the bundle field populated.
-    entity_test_create_bundle('custom');
+    EntityTestHelper::createBundle('custom');
     $this->entityTypeManager->getStorage('entity_test_update')->create(['type' => 'test_bundle', 'new_bundle_field' => 'foo'])->save();
 
     // Change the field's field type and apply updates. It's expected to
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php
index b7b65c33bbbe..59ca91e9ff84 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\comment\Entity\CommentType;
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\NodeType;
 
@@ -50,8 +51,8 @@ protected function setUp(): void {
       'label' => 'Default comment',
       'target_entity_type_id' => 'node',
     ])->save();
-    entity_test_create_bundle('foo', NULL, 'entity_test_no_bundle');
-    entity_test_create_bundle('entity_test_no_bundle', NULL, 'entity_test_no_bundle');
+    EntityTestHelper::createBundle('foo', NULL, 'entity_test_no_bundle');
+    EntityTestHelper::createBundle('entity_test_no_bundle', NULL, 'entity_test_no_bundle');
     $this->typedDataManager = $this->container->get('typed_data_manager');
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index 5e34ef2dc178..5e43c0bea2c5 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -659,7 +659,7 @@ public function testDataTypes(): void {
       $this->assertNotEmpty($types['entity:' . $entity_type]['class'], 'Entity data type registered.');
     }
     // Check bundle types are provided as well.
-    entity_test_create_bundle('bundle');
+    EntityTestHelper::createBundle('bundle');
     $types = \Drupal::typedDataManager()->getDefinitions();
     $this->assertNotEmpty($types['entity:entity_test:bundle']['class'], 'Entity bundle data type registered.');
   }
@@ -694,7 +694,7 @@ public function testBaseFieldNonExistingBaseField(): void {
   public function testFieldOverrideBundleField(): void {
     // First make sure the bundle field override in code, which is provided by
     // the test entity works.
-    entity_test_create_bundle('some_test_bundle', 'Some test bundle', 'entity_test_field_override');
+    EntityTestHelper::createBundle('some_test_bundle', 'Some test bundle', 'entity_test_field_override');
     $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('entity_test_field_override', 'entity_test_field_override');
     $this->assertEquals('The default description.', $field_definitions['name']->getDescription());
     $this->assertNull($field_definitions['name']->getTargetBundle());
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
index 07e29ba3e9fa..803c726f8b07 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\taxonomy\Entity\Term;
 use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
@@ -76,7 +77,7 @@ protected function setUp(): void {
     $vocabulary->save();
 
     // Second, create the field.
-    entity_test_create_bundle('test_bundle');
+    EntityTestHelper::createBundle('test_bundle');
     $this->fieldName = $this->randomMachineName();
     $handler_settings = [
       'target_bundles' => [
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index ebaa0e299fd5..3140cab146be 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\Query\QueryException;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestMulRev;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field_test\FieldTestHelper;
@@ -97,7 +98,7 @@ protected function setUp(): void {
       do {
         $bundle = $this->randomMachineName();
       } while ($bundles && strtolower($bundles[0]) >= strtolower($bundle));
-      entity_test_create_bundle($bundle, entity_type: $field_storage->getTargetEntityTypeId());
+      EntityTestHelper::createBundle($bundle, entity_type: $field_storage->getTargetEntityTypeId());
       foreach ($field_storages as $field_storage) {
         FieldConfig::create([
           'field_storage' => $field_storage,
@@ -563,7 +564,7 @@ public function testCount(): void {
     ]);
     $field_storage->save();
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle);
+    EntityTestHelper::createBundle($bundle);
     FieldConfig::create([
       'field_storage' => $field_storage,
       'bundle' => $bundle,
@@ -815,7 +816,7 @@ public function testMetaData(): void {
    */
   public function testCaseSensitivity(): void {
     $bundle = $this->randomMachineName();
-    entity_test_create_bundle($bundle, entity_type: 'entity_test_mulrev');
+    EntityTestHelper::createBundle($bundle, entity_type: 'entity_test_mulrev');
 
     $field_storage = FieldStorageConfig::create([
       'field_name' => 'field_ci',
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
index f12c7229c709..15664e8efbe9 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\Tests\SchemaCheckTestTrait;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageException;
@@ -108,7 +109,7 @@ public function testEntityReferenceFieldValidation(): void {
     $this->assertEquals(sprintf('The referenced entity (%s: 9999) does not exist.', $this->referencedEntityType), $violations[0]->getMessage());
 
     // Test a non-referenceable bundle.
-    entity_test_create_bundle('non_referenceable', NULL, $this->referencedEntityType);
+    EntityTestHelper::createBundle('non_referenceable', NULL, $this->referencedEntityType);
     $referenced_entity = $this->entityTypeManager
       ->getStorage($this->referencedEntityType)
       ->create(['type' => 'non_referenceable']);
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php
index 2e7fa4327631..7c0488994295 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 
 /**
  * Test view/render hooks for entities.
@@ -25,7 +26,7 @@ class EntityViewHookTest extends EntityKernelTestBase {
    * Tests hook_entity_display_build_alter().
    */
   public function testHookEntityDisplayBuildAlter(): void {
-    entity_test_create_bundle('display_build_alter_bundle');
+    EntityTestHelper::createBundle('display_build_alter_bundle');
     /** @var \Drupal\Core\Render\RendererInterface $renderer */
     $renderer = $this->container->get('renderer');
 
diff --git a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterTest.php
index aa2e1ca7f22f..e3a781a1138d 100644
--- a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\KernelTests\Core\ParamConverter;
 
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\EntityTestHelper;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\Tests\user\Traits\UserCreationTrait;
 
@@ -36,9 +37,9 @@ protected function setUp(): void {
     $this->installEntitySchema('entity_test');
 
     // Create some testing bundles for 'entity_test' entity type.
-    entity_test_create_bundle('foo', 'Foo');
-    entity_test_create_bundle('bar', 'Bar');
-    entity_test_create_bundle('baz', 'Baz');
+    EntityTestHelper::createBundle('foo', 'Foo');
+    EntityTestHelper::createBundle('bar', 'Bar');
+    EntityTestHelper::createBundle('baz', 'Baz');
   }
 
   /**
-- 
GitLab