function EntityTypeTest::testGetHandler
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetHandler()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetHandler()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetHandler()
Tests the getHandler() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeTest.php, line 159
Class
- EntityTypeTest
- @coversDefaultClass \Drupal\Core\Entity\EntityType @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetHandler() {
$controller = $this->getTestHandlerClass();
$entity_type = $this->setUpEntityType([
'handlers' => [
'storage' => $controller,
'form' => [
'default' => $controller,
],
],
]);
$this->assertSame($controller, $entity_type->getHandlerClass('storage'));
$this->assertSame($controller, $entity_type->getHandlerClass('form', 'default'));
$this->assertNull($entity_type->getHandlerClass('foo'));
$this->assertNull($entity_type->getHandlerClass('foo', 'bar'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.