function EntityBundleEntityTest::testWithoutBundleEntity

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php \Drupal\KernelTests\Core\Entity\EntityBundleEntityTest::testWithoutBundleEntity()

Tests an entity type without config entities for bundles.

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

@legacy-covers ::getBundleEntity

File

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

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.