public function RouteMatchTestBase::routeMatchProvider in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php \Drupal\Tests\Core\Routing\RouteMatchTestBase::routeMatchProvider()
Provide sets of parameters and expected parameters for parameter tests.
File
- core/
tests/ Drupal/ Tests/ Core/ Routing/ RouteMatchTestBase.php, line 38 - Contains \Drupal\Tests\Core\Routing\RouteMatchTestBase.
Class
- RouteMatchTestBase
- Base test class for testing classes implementing the route match interface.
Namespace
Drupal\Tests\Core\RoutingCode
public function routeMatchProvider() {
$base_data = array(
array(
new Route('/test-route/{param_without_leading_underscore}/{_param_with_leading_underscore}', array(
'default_without_leading_underscore' => NULL,
'_default_with_leading_underscore' => NULL,
)),
array(
'param_without_leading_underscore' => 'value',
'_param_with_leading_underscore' => 'value',
'default_without_leading_underscore' => 'value',
'_default_with_leading_underscore' => 'value',
'foo' => 'value',
),
// Parameters should be filtered to only those defined by the route.
// Specifically:
// - Path parameters, regardless of name.
// - Defaults that are not path parameters only if they do not start with
// an underscore.
array(
'param_without_leading_underscore' => 'value',
'_param_with_leading_underscore' => 'value',
'default_without_leading_underscore' => 'value',
),
),
);
$data = array();
foreach ($base_data as $entry) {
$route = $entry[0];
$params = $entry[1];
$expected_params = $entry[2];
$data[] = array(
$this
->getRouteMatch('test_route', $route, $params, $params),
$route,
$params,
$expected_params,
);
}
return $data;
}