public function EntityTypeManagerTest::testGetHandler in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetHandler()
- 9 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 271 - Contains \Drupal\Tests\Core\Entity\EntityTypeManagerTest.
Class
- EntityTypeManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetHandler() {
$class = get_class($this
->getMockForAbstractClass(TestEntityHandlerBase::class));
$apple = $this
->prophesize(EntityTypeInterface::class);
$apple
->getHandlerClass('storage')
->willReturn($class);
$this
->setUpEntityTypeDefinitions([
'apple' => $apple,
]);
$apple_controller = $this->entityTypeManager
->getHandler('apple', 'storage');
$this
->assertInstanceOf($class, $apple_controller);
$this
->assertInstanceOf(ModuleHandlerInterface::class, $apple_controller->moduleHandler);
$this
->assertInstanceOf(TranslationInterface::class, $apple_controller->stringTranslation);
}