function EntityBundleEntityTest::testWithoutBundleEntity

Tests an entity type without config entities for bundles.

EntityTest doesn't have bundles, but does have the bundle entity key.

@covers ::getBundleEntity

File

core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php, line 64

Class

EntityBundleEntityTest
Tests the getBundleEntity() method.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testWithoutBundleEntity() : void {
  $entity = EntityTest::create([
    'name' => 'foo',
  ]);
  $entity->save();
  $this->assertNull($entity->getBundleEntity());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.