You are here

public function TitleResolverTest::testStaticTitle in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php \Drupal\Tests\Core\Controller\TitleResolverTest::testStaticTitle()
  2. 9 core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php \Drupal\Tests\Core\Controller\TitleResolverTest::testStaticTitle()

Tests a static title without a context.

See also

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

File

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

Class

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

Namespace

Drupal\Tests\Core\Controller

Code

public function testStaticTitle() {
  $request = new Request();
  $route = new Route('/test-route', [
    '_title' => 'static title',
  ]);
  $this
    ->assertEquals(new TranslatableMarkup('static title', [], [], $this->translationManager), $this->titleResolver
    ->getTitle($request, $route));
}