You are here

public function EntityRevisionRouteEnhancerTest::testEnhanceWithoutEntityRevision in Entity API 8.0

@covers ::enhance

File

tests/src/Unit/RouteEnhancer/EntityRevisionRouteEnhancerTest.php, line 66
Contains \Drupal\Tests\Unit\RouteEnhancer\EntityRevisionRouteEnhancerTest.

Class

EntityRevisionRouteEnhancerTest
@coversDefaultClass \Drupal\entity\RouteEnhancer\EntityRevisionRouteEnhancer @group entity

Namespace

Drupal\Tests\Unit\RouteEnhancer

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));
}