function DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetEntityTypeIdKeyType()
  3. 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

Class

DefaultHtmlRouteProviderTest
@coversDefaultClass \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider[[api-linebreak]] @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);
}

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