You are here

public function DefaultHtmlRouteProviderTest::testGetCanonicalRoute in Drupal 9

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

@covers ::getCanonicalRoute @dataProvider providerTestGetCanonicalRoute

File

core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php, line 204
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 testGetCanonicalRoute(Route $expected = NULL, EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $field_storage_definition = NULL) {
  if ($field_storage_definition) {
    $this->entityFieldManager
      ->getFieldStorageDefinitions($entity_type
      ->id())
      ->willReturn([
      $entity_type
        ->getKey('id') => $field_storage_definition,
    ]);
  }
  $route = $this->routeProvider
    ->getCanonicalRoute($entity_type);
  $this
    ->assertEquals($expected, $route);
}