function EntityTypeManagerTest::testGetHandler
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandler()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandler()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandler()
Tests the getHandler() method.
@covers ::getHandler
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeManagerTest.php, line 300
Class
- EntityTypeManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetHandler() : void {
$apple = $this->prophesize(EntityTypeInterface::class);
$apple->getHandlerClass('storage')
->willReturn(StubEntityHandlerBase::class);
$this->setUpEntityTypeDefinitions([
'apple' => $apple,
]);
$apple_controller = $this->entityTypeManager
->getHandler('apple', 'storage');
$this->assertInstanceOf(StubEntityHandlerBase::class, $apple_controller);
$this->assertInstanceOf(ModuleHandlerInterface::class, $apple_controller->moduleHandler);
$this->assertInstanceOf(TranslationInterface::class, $apple_controller->stringTranslation);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.