function LocalTaskDefaultTest::testGetTitleWithContext

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

@covers ::getTitle

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php, line 271

Class

LocalTaskDefaultTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitleWithContext() : void {
    $title = 'Example';
    $this->pluginDefinition['title'] = new TranslatableMarkup($title, [], [
        'context' => 'context',
    ], $this->stringTranslation);
    $this->stringTranslation
        ->expects($this->once())
        ->method('translateString')
        ->with($this->pluginDefinition['title'])
        ->willReturn('Example translated with context');
    $this->setupLocalTaskDefault();
    $this->assertEquals('Example translated with context', $this->localTaskBase
        ->getTitle());
}

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