function EntityTypeManagerTest::testGetHandlerMissingHandler
Tests the getHandler() method when no controller is defined.
@legacy-covers ::getHandler
Attributes
#[DataProvider('provideMissingHandlerData')]
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeManagerTest.php, line 363
Class
Namespace
Drupal\Tests\Core\EntityCode
public function testGetHandlerMissingHandler(string $entity_type, string $handler_name, string $handler_class, $exception_message) : void {
$entity = $this->prophesize(EntityTypeInterface::class);
$entity->getHandlerClass($handler_name)
->willReturn(NULL);
if (!$handler_class) {
$entity->getHandlerClasses()
->willReturn([]);
}
else {
$entity->getHandlerClasses()
->willReturn([
$handler_name => $handler_class,
]);
}
$this->setUpEntityTypeDefinitions([
$entity_type => $entity,
]);
$this->expectException(InvalidPluginDefinitionException::class);
$this->expectExceptionMessage($exception_message);
$this->entityTypeManager
->getHandler($entity_type, $handler_name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.