function EntityTypeManagerTest::testGetHandlerMissingHandler
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandlerMissingHandler()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandlerMissingHandler()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandlerMissingHandler()
Tests the getHandler() method when no controller is defined.
@covers ::getHandler
@dataProvider provideMissingHandlerData
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeManagerTest.php, line 344
Class
- EntityTypeManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeManager @group Entity
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.