function ParamConverterManagerTest::testSetRouteParameterConverters
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testSetRouteParameterConverters()
- 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testSetRouteParameterConverters()
- 11.x core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testSetRouteParameterConverters()
@covers ::setRouteParameterConverters
@dataProvider providerTestSetRouteParameterConverters
File
-
core/
tests/ Drupal/ Tests/ Core/ ParamConverter/ ParamConverterManagerTest.php, line 132
Class
- ParamConverterManagerTest
- @coversDefaultClass \Drupal\Core\ParamConverter\ParamConverterManager @group ParamConverter
Namespace
Drupal\Tests\Core\ParamConverterCode
public function testSetRouteParameterConverters($path, $parameters = NULL, $expected = NULL) : void {
$converter = $this->createMock('Drupal\\Core\\ParamConverter\\ParamConverterInterface');
$converter->expects($this->any())
->method('applies')
->with($this->anything(), 'id', $this->anything())
->willReturn(TRUE);
$this->manager
->addConverter($converter, 'applied');
$route = new Route($path);
if ($parameters) {
$route->setOption('parameters', $parameters);
}
$collection = new RouteCollection();
$collection->add('test_route', $route);
$this->manager
->setRouteParameterConverters($collection);
foreach ($collection as $route) {
$result = $route->getOption('parameters');
if ($expected) {
$this->assertSame($expected, $result['id']['converter']);
}
else {
$this->assertNull($result);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.