You are here

public function EntityRevisionRouteEnhancerTest::testEnhanceWithEntityRevision in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php \Drupal\Tests\Core\Enhancer\EntityRevisionRouteEnhancerTest::testEnhanceWithEntityRevision()
  2. 9 core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php \Drupal\Tests\Core\Enhancer\EntityRevisionRouteEnhancerTest::testEnhanceWithEntityRevision()

@covers ::enhance

File

core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php, line 62

Class

EntityRevisionRouteEnhancerTest
@coversDefaultClass \Drupal\Core\Routing\Enhancer\EntityRevisionRouteEnhancer @group Entity

Namespace

Drupal\Tests\Core\Enhancer

Code

public function testEnhanceWithEntityRevision() {
  $route = new Route('/test-path/{entity_test_revision}', [], [], [
    'parameters' => [
      'entity_test_revision' => [
        'type' => 'entity_revision:entity_test',
      ],
    ],
  ]);
  $request = Request::create('/test-path/123');
  $entity = $this
    ->prophesize(EntityInterface::class);
  $defaults = [];
  $defaults['entity_test_revision'] = $entity
    ->reveal();
  $defaults[RouteObjectInterface::ROUTE_OBJECT] = $route;
  $expected = $defaults;
  $expected['_entity_revision'] = $defaults['entity_test_revision'];
  $this
    ->assertEquals($expected, $this->routeEnhancer
    ->enhance($defaults, $request));
}