public function TitleResolverTest::testDynamicTitle in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php \Drupal\Tests\Core\Controller\TitleResolverTest::testDynamicTitle()
Tests a dynamic title.
See also
\Drupal\Core\Controller\TitleResolver::getTitle()
File
- core/
tests/ Drupal/ Tests/ Core/ Controller/ TitleResolverTest.php, line 119 - Contains \Drupal\Tests\Core\Controller\TitleResolverTest.
Class
- TitleResolverTest
- @coversDefaultClass \Drupal\Core\Controller\TitleResolver @group Controller
Namespace
Drupal\Tests\Core\ControllerCode
public function testDynamicTitle() {
$request = new Request();
$route = new Route('/test-route', array(
'_title' => 'static title',
'_title_callback' => 'Drupal\\Tests\\Core\\Controller\\TitleCallback::example',
));
$callable = array(
new TitleCallback(),
'example',
);
$this->controllerResolver
->expects($this
->once())
->method('getControllerFromDefinition')
->with('Drupal\\Tests\\Core\\Controller\\TitleCallback::example')
->will($this
->returnValue($callable));
$this->controllerResolver
->expects($this
->once())
->method('getArguments')
->with($request, $callable)
->will($this
->returnValue(array(
'example',
)));
$this
->assertEquals('test example', $this->titleResolver
->getTitle($request, $route));
}