public function LocalTaskDefaultTest::testGetTitleWithContext in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetTitleWithContext()
- 9 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 
- Contains \Drupal\Tests\Core\Menu\LocalTaskDefaultTest.
Class
- LocalTaskDefaultTest
- @coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault @group Menu
Namespace
Drupal\Tests\Core\MenuCode
public function testGetTitleWithContext() {
  $title = 'Example';
  $this->pluginDefinition['title'] = new TranslatableMarkup($title, [], [
    'context' => 'context',
  ], $this->stringTranslation);
  $this->stringTranslation
    ->expects($this
    ->once())
    ->method('translateString')
    ->with($this->pluginDefinition['title'])
    ->will($this
    ->returnValue('Example translated with context'));
  $this
    ->setupLocalTaskDefault();
  $this
    ->assertEquals('Example translated with context', $this->localTaskBase
    ->getTitle());
}