public function TitleResolverTest::testStaticTitleWithParameter 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::testStaticTitleWithParameter()
Tests a static title with a parameter.
@dataProvider providerTestStaticTitleWithParameter
See also
\Drupal\Core\Controller\TitleResolver::getTitle()
File
- core/
tests/ Drupal/ Tests/ Core/ Controller/ TitleResolverTest.php, line 91 - Contains \Drupal\Tests\Core\Controller\TitleResolverTest.
Class
- TitleResolverTest
- @coversDefaultClass \Drupal\Core\Controller\TitleResolver @group Controller
Namespace
Drupal\Tests\Core\ControllerCode
public function testStaticTitleWithParameter($title, $expected_title) {
$raw_variables = new ParameterBag(array(
'test' => 'value',
'test2' => 'value2',
));
$request = new Request();
$request->attributes
->set('_raw_variables', $raw_variables);
$route = new Route('/test-route', array(
'_title' => $title,
));
$this->translationManager
->expects($this
->once())
->method('translate')
->with($title, $this
->logicalOr($this
->arrayHasKey('@test'), $this
->arrayHasKey('%test'), $this
->arrayHasKey('!test')), array())
->will($this
->returnValue('static title value'));
$this
->assertEquals($expected_title, $this->titleResolver
->getTitle($request, $route));
}