public function EntityTypeRepositoryTest::testGetEntityTypeFromClassAmbiguous in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php \Drupal\Tests\Core\Entity\EntityTypeRepositoryTest::testGetEntityTypeFromClassAmbiguous()
@covers ::getEntityTypeFromClass
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeRepositoryTest.php, line 158
Class
- EntityTypeRepositoryTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeRepository @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetEntityTypeFromClassAmbiguous() {
$boskoop = $this
->prophesize(EntityTypeInterface::class);
$boskoop
->getOriginalClass()
->willReturn('\\Drupal\\apple\\Entity\\Apple');
$boskoop
->id()
->willReturn('boskop');
$gala = $this
->prophesize(EntityTypeInterface::class);
$gala
->getOriginalClass()
->willReturn('\\Drupal\\apple\\Entity\\Apple');
$gala
->id()
->willReturn('gala');
$this
->setUpEntityTypeDefinitions([
'boskoop' => $boskoop,
'gala' => $gala,
]);
$this
->expectException(AmbiguousEntityClassException::class);
$this
->expectExceptionMessage('Multiple entity types found for \\Drupal\\apple\\Entity\\Apple.');
$this->entityTypeRepository
->getEntityTypeFromClass('\\Drupal\\apple\\Entity\\Apple');
}