function EntityBundleEntityTest::testWithBundleKeyEntity

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

Tests an entity type without the bundle entity key.

@legacy-covers ::getBundleEntity

File

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

Class

EntityBundleEntityTest
Tests the getBundleEntity() method.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testWithBundleKeyEntity() : void {
  $entity = EntityTestNoBundleWithLabel::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.