You are here

public function DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType()

@covers ::getEntityTypeIdKeyType

File

core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php, line 310
Contains \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest.

Class

DefaultHtmlRouteProviderTest
@coversDefaultClass \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider @group Entity

Namespace

Drupal\Tests\Core\Entity\Routing

Code

public function testGetEntityTypeIdKeyType() {
  $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);
}