function DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType

Tests get entity type id key type.

@legacy-covers ::getEntityTypeIdKeyType

File

core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php, line 369

Class

DefaultHtmlRouteProviderTest
Tests Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider.

Namespace

Drupal\Tests\Core\Entity\Routing

Code

public function testGetEntityTypeIdKeyType() : void {
  $entity_type = $this->prophesize(EntityTypeInterface::class);
  $entity_type->entityClassImplements(FieldableEntityInterface::class)
    ->willReturn(TRUE);
  $entity_type->id()
    ->willReturn('the_entity_type_id');
  $entity_type->getKey('id')
    ->willReturn('id');
  $field_storage_definition = $this->prophesize(FieldStorageDefinitionInterface::class);
  $field_storage_definition->getType()
    ->willReturn('integer');
  $this->entityFieldManager
    ->getFieldStorageDefinitions('the_entity_type_id')
    ->willReturn([
    'id' => $field_storage_definition,
  ]);
  $type = $this->routeProvider
    ->getEntityTypeIdKeyType($entity_type->reveal());
  $this->assertSame('integer', $type);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.