You are here

public function DefaultHtmlRouteProviderTest::testGetAddFormRoute 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::testGetAddFormRoute()

@covers ::getAddFormRoute @dataProvider providerTestGetAddFormRoute

File

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