You are here

public function TitleResolverTest::testStaticTitleWithContext in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php \Drupal\Tests\Core\Controller\TitleResolverTest::testStaticTitleWithContext()

Tests a static title with a context.

See also

\Drupal\Core\Controller\TitleResolver::getTitle()

File

core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php, line 72
Contains \Drupal\Tests\Core\Controller\TitleResolverTest.

Class

TitleResolverTest
@coversDefaultClass \Drupal\Core\Controller\TitleResolver @group Controller

Namespace

Drupal\Tests\Core\Controller

Code

public function testStaticTitleWithContext() {
  $request = new Request();
  $route = new Route('/test-route', array(
    '_title' => 'static title',
    '_title_context' => 'context',
  ));
  $this->translationManager
    ->expects($this
    ->once())
    ->method('translate')
    ->with('static title', array(), array(
    'context' => 'context',
  ))
    ->will($this
    ->returnValue('translated title with context'));
  $this
    ->assertEquals('translated title with context', $this->titleResolver
    ->getTitle($request, $route));
}