function LocalTaskDefaultTest::testGetRouteParametersForDynamicRouteWithUpcastedParameters

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetRouteParametersForDynamicRouteWithUpcastedParameters()
  2. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetRouteParametersForDynamicRouteWithUpcastedParameters()
  3. 10 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetRouteParametersForDynamicRouteWithUpcastedParameters()

Tests the getRouteParameters method for a route with upcasted parameters.

@covers ::getRouteParameters

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php, line 148

Class

LocalTaskDefaultTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetRouteParametersForDynamicRouteWithUpcastedParameters() : void {
    $this->pluginDefinition = [
        'route_name' => 'test_route',
    ];
    $route = new Route('/test-route/{parameter}');
    $this->routeProvider
        ->expects($this->once())
        ->method('getRouteByName')
        ->with('test_route')
        ->willReturn($route);
    $this->setupLocalTaskDefault();
    $route_match = new RouteMatch('', $route, [
        'parameter' => (object) 'example2',
    ], [
        'parameter' => 'example',
    ]);
    $this->assertEquals([
        'parameter' => 'example',
    ], $this->localTaskBase
        ->getRouteParameters($route_match));
}

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