function DefaultHtmlRouteProviderTest::testGetCanonicalRoute

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetCanonicalRoute()
  2. 9 core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetCanonicalRoute()
  3. 8.9.x core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::testGetCanonicalRoute()

Tests get canonical route.

@legacy-covers ::getCanonicalRoute

Attributes

#[DataProvider('providerTestGetCanonicalRoute')]

File

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

Class

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

Namespace

Drupal\Tests\Core\Entity\Routing

Code

public function testGetCanonicalRoute(?Route $expected, EntityTypeInterface $entity_type, ?FieldStorageDefinitionInterface $field_storage_definition = NULL) : void {
  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);
}

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