You are here

public function LocalTaskDefaultTest::testGetRouteParametersForDynamicRouteWithUpcastedParameters in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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
Contains \Drupal\Tests\Core\Menu\LocalTaskDefaultTest.

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

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