function EntityBundleEntityTest::testWithConfigBundleEntity
Tests an entity type with config entities for bundles.
@covers ::getBundleEntity
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityBundleEntityTest.php, line 42
Class
- EntityBundleEntityTest
- Tests the getBundleEntity() method.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testWithConfigBundleEntity() : void {
$bundleEntity = EntityTestBundle::create([
'id' => 'bundle_alpha',
'label' => 'Alpha',
]);
$bundleEntity->save();
$entity = EntityTestWithBundle::create([
'type' => 'bundle_alpha',
'name' => 'foo',
]);
$entity->save();
$this->assertEquals($bundleEntity->id(), $entity->getBundleEntity()
->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.