You are here

public function BundleClassTest::testEntityNoBundleSubclass in Drupal 10

Tests making use of a custom bundle class for an entity without bundles.

File

core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php, line 201

Class

BundleClassTest
Tests entity bundle classes.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testEntityNoBundleSubclass() {
  $this->container
    ->get('state')
    ->set('entity_test_bundle_class_enable_user_class', TRUE);
  $this->container
    ->get('kernel')
    ->rebuildContainer();
  $this->entityTypeManager
    ->clearCachedDefinitions();
  $this
    ->drupalSetUpCurrentUser();
  $entity = User::load(1);
  $this
    ->assertInstanceOf(EntityTestUserClass::class, $entity);
}