function EntityTypeRepositoryTest::testGetEntityTypeFromClassDecoratedClass
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php \Drupal\Tests\Core\Entity\EntityTypeRepositoryTest::testGetEntityTypeFromClassDecoratedClass()
Tests the ::getEntityTypeFromClass() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeRepositoryTest.php, line 232
Class
Namespace
Drupal\Tests\Core\EntityCode
public function testGetEntityTypeFromClassDecoratedClass() : void {
$apple = $this->prophesize(EntityTypeInterface::class);
$apple->getOriginalClass()
->willReturn(Apple::class);
$apple->getDecoratedClasses()
->willReturn([
Apple::class,
RoyalGala::class,
]);
$apple->getClass()
->willReturn(Apple::class);
$apple->id()
->willReturn('apple');
$this->setUpEntityTypeDefinitions([
'apple' => $apple,
]);
$this->assertSame('apple', $this->entityTypeRepository
->getEntityTypeFromClass(RoyalGala::class));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.