You are here

public function LocalActionDefaultTest::testGetTitleWithTitleArguments in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php \Drupal\Tests\Core\Menu\LocalActionDefaultTest::testGetTitleWithTitleArguments()

Tests the getTitle method with title arguments.

File

core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php, line 109

Class

LocalActionDefaultTest
@coversDefaultClass \Drupal\Core\Menu\LocalActionDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitleWithTitleArguments() {
  $this->pluginDefinition['title'] = new TranslatableMarkup('Example @test', [
    '@test' => 'value',
  ], [], $this->stringTranslation);
  $this->stringTranslation
    ->expects($this
    ->once())
    ->method('translateString')
    ->with($this->pluginDefinition['title'])
    ->will($this
    ->returnValue('Example value'));
  $this
    ->setupLocalActionDefault();
  $request = new Request();
  $this
    ->assertEquals('Example value', $this->localActionDefault
    ->getTitle($request));
}