public function BundleClassTest::testBundleClassShouldExist in Drupal 10
Checks exception thrown if a bundle class doesn't exist.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BundleClassTest.php, line 256
Class
- BundleClassTest
- Tests entity bundle classes.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testBundleClassShouldExist() {
$this->container
->get('state')
->set('entity_test_bundle_class_does_not_exist', TRUE);
$this->entityTypeManager
->clearCachedDefinitions();
$this
->expectException(MissingBundleClassException::class);
entity_test_create_bundle('bundle_class');
$this->storage
->create([
'type' => 'bundle_class',
]);
}