public function testAmbiguousBundleClassExceptionEntityTypeRepository() { $this->container->
get('state'
)->
set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE
);
entity_test_create_bundle('entity_test_no_label'
);
entity_test_create_bundle('entity_test_no_label', NULL, 'entity_test_no_label'
);
// Now that we have an entity bundle class that's shared by two entirely
// different entity types, we expect an exception to be thrown.
$this->
expectException(AmbiguousBundleClassException::
class);
$entity_type =
$this->container->
get('entity_type.repository'
)->
getEntityTypeFromClass(EntityTestAmbiguousBundleClass::
class);
} /**
* Checks exception thrown if a bundle class doesn't extend the entity class.
*/
public function testBundleClassShouldExtendEntityClass() { $this->container->
get('state'
)->
set('entity_test_bundle_class_non_inheriting', TRUE
);
$this->entityTypeManager->
clearCachedDefinitions();
$this->
expectException(BundleClassInheritanceException::
class);
entity_test_create_bundle('bundle_class'
);
$this->storage->
create(['type' => 'bundle_class'
]);
}