function EntityRevisionRouteEnhancerTest::testEnhanceWithoutEntityRevision

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php \Drupal\Tests\Core\Enhancer\EntityRevisionRouteEnhancerTest::testEnhanceWithoutEntityRevision()
  2. 10 core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php \Drupal\Tests\Core\Enhancer\EntityRevisionRouteEnhancerTest::testEnhanceWithoutEntityRevision()
  3. 11.x 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));
}

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