function BundleClassTest::testAmbiguousBundleClassExceptionCreate
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::testAmbiguousBundleClassExceptionCreate()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::testAmbiguousBundleClassExceptionCreate()
Checks exception is thrown if two bundles share the same bundle class.
@covers Drupal\Core\Entity\ContentEntityStorageBase::create
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BundleClassTest.php, line 215
Class
- BundleClassTest
- Tests entity bundle classes.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testAmbiguousBundleClassExceptionCreate() {
$this->container
->get('state')
->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE);
$this->entityTypeManager
->clearCachedDefinitions();
entity_test_create_bundle('bundle_class');
entity_test_create_bundle('bundle_class_2');
// Since we now have two bundles trying to reuse the same class, we expect
// this to throw an exception.
$this->expectException(AmbiguousBundleClassException::class);
EntityTestBundleClass::create();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.