function BundleClassTest::testEntityClassNotTakenFromActiveDefinitions
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::testEntityClassNotTakenFromActiveDefinitions()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::testEntityClassNotTakenFromActiveDefinitions()
Tests that a module can override an entity-type class.
Ensures a module can implement hook_entity_info_alter() and alter the entity's class without needing to write to the last installed definitions repository.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BundleClassTest.php, line 271
Class
- BundleClassTest
- Tests entity bundle classes.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testEntityClassNotTakenFromActiveDefinitions() : void {
$this->container
->get('state')
->set('entity_test_bundle_class_override_base_class', TRUE);
$this->entityTypeManager
->clearCachedDefinitions();
$this->assertEquals(EntityTestVariant::class, $this->entityTypeManager
->getStorage('entity_test')
->getEntityClass());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.