public function LocalActionDefaultTest::testGetTitleWithContext in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php \Drupal\Tests\Core\Menu\LocalActionDefaultTest::testGetTitleWithContext()
Tests the getTitle method with a translation context.
See also
\Drupal\Core\Menu\LocalTaskDefault::getTitle()
File
- core/
tests/ Drupal/ Tests/ Core/ Menu/ LocalActionDefaultTest.php, line 95
Class
- LocalActionDefaultTest
- @coversDefaultClass \Drupal\Core\Menu\LocalActionDefault @group Menu
Namespace
Drupal\Tests\Core\MenuCode
public function testGetTitleWithContext() {
$this->pluginDefinition['title'] = new TranslatableMarkup('Example', [], [
'context' => 'context',
], $this->stringTranslation);
$this->stringTranslation
->expects($this
->once())
->method('translateString')
->with($this->pluginDefinition['title'])
->will($this
->returnValue('Example translated with context'));
$this
->setupLocalActionDefault();
$this
->assertEquals('Example translated with context', $this->localActionDefault
->getTitle());
}