function UrlGeneratorTest::aliasManagerCallback
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::aliasManagerCallback()
- 8.9.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::aliasManagerCallback()
- 11.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::aliasManagerCallback()
Return value callback for getAliasByPath() on the mock alias manager.
Ensures that by default the call to getAliasByPath() will return the first argument that was passed in. We special-case the paths for which we wish it to return an actual alias.
Return value
string
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ UrlGeneratorTest.php, line 190
Class
- UrlGeneratorTest
- Confirm that the UrlGenerator is functioning properly.
Namespace
Drupal\Tests\Core\RoutingCode
public function aliasManagerCallback() {
$args = func_get_args();
switch ($args[0]) {
case '/test/one':
return '/hello/world';
case '/test/two/5':
return '/goodbye/cruel/world';
case '/<front>':
return '/';
default:
return $args[0];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.