function DefaultHtmlRouteProviderTest::testGetAddFormRoute

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

Class

DefaultHtmlRouteProviderTest
@coversDefaultClass \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider @group Entity

Namespace

Drupal\Tests\Core\Entity\Routing

Code

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

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