You are here

public function DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 28
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_manager = $this
    ->prophesize(EntityManagerInterface::class);
  $route_provider = new TestDefaultHtmlRouteProvider($entity_manager
    ->reveal());
  $entity_type = $this
    ->prophesize(EntityTypeInterface::class);
  $entity_type
    ->isSubclassOf(FieldableEntityInterface::class)
    ->willReturn(TRUE);
  $entity_type_id = 'the_entity_type_id';
  $entity_type
    ->id()
    ->willReturn($entity_type_id);
  $entity_type
    ->getKey('id')
    ->willReturn('id');
  $field_storage_definition = $this
    ->prophesize(FieldStorageDefinitionInterface::class);
  $field_storage_definition
    ->getType()
    ->willReturn('integer');
  $entity_manager
    ->getFieldStorageDefinitions($entity_type_id)
    ->willReturn([
    'id' => $field_storage_definition,
  ]);
  $type = $route_provider
    ->getEntityTypeIdKeyType($entity_type
    ->reveal());
  $this
    ->assertSame('integer', $type);
}