You are here

public function EntityResolverManagerTest::testSetRouteOptionsWithEntityViewRouteAndManualParameters in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php \Drupal\Tests\Core\Entity\EntityResolverManagerTest::testSetRouteOptionsWithEntityViewRouteAndManualParameters()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php \Drupal\Tests\Core\Entity\EntityResolverManagerTest::testSetRouteOptionsWithEntityViewRouteAndManualParameters()

Tests setRouteOptions() with an _entity_view route.

@covers ::setRouteOptions @covers ::getControllerClass @covers ::getEntityTypes @covers ::setParametersFromReflection @covers ::setParametersFromEntityInformation

File

core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php, line 298
Contains \Drupal\Tests\Core\Entity\EntityResolverManagerTest.

Class

EntityResolverManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityResolverManager @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testSetRouteOptionsWithEntityViewRouteAndManualParameters() {
  $this
    ->setupEntityTypes();
  $route = new Route('/example/{foo}', [
    '_entity_view' => 'entity_test.view',
  ], [], [
    'parameters' => [
      'foo' => [
        'type' => 'entity:entity_test',
      ],
    ],
  ]);
  $defaults = $route
    ->getDefaults();
  $this->entityResolverManager
    ->setRouteOptions($route);
  $this
    ->assertEquals($defaults, $route
    ->getDefaults());
  $parameters = $route
    ->getOption('parameters');
  $this
    ->assertEquals([
    'foo' => [
      'type' => 'entity:entity_test',
    ],
  ], $parameters);
}