function ContextualLinkDefaultTest::testGetTitleWithTitleArguments

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitleWithTitleArguments()
  2. 8.9.x core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitleWithTitleArguments()
  3. 10 core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitleWithTitleArguments()

@covers ::getTitle

File

core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php, line 101

Class

ContextualLinkDefaultTest
@group Menu @coversDefaultClass \Drupal\Core\Menu\ContextualLinkDefault

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitleWithTitleArguments() : void {
    $title = 'Example @test';
    $this->pluginDefinition['title'] = new TranslatableMarkup($title, [
        '@test' => 'value',
    ], [], $this->stringTranslation);
    $this->stringTranslation
        ->expects($this->once())
        ->method('translateString')
        ->with($this->pluginDefinition['title'])
        ->willReturn('Example value');
    $this->setupContextualLinkDefault();
    $request = new Request();
    $this->assertEquals('Example value', $this->contextualLinkDefault
        ->getTitle($request));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.