You are here

public function EntityRevisionRouteEnhancerTest::testEnhanceWithoutEntityRevision in Drupal 8

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

@covers ::enhance

File

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

Class

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

Namespace

Drupal\Tests\Core\Enhancer

Code

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