function LocalActionDefaultTest::testGetTitleWithTitleArguments

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php \Drupal\Tests\Core\Menu\LocalActionDefaultTest::testGetTitleWithTitleArguments()
  2. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php \Drupal\Tests\Core\Menu\LocalActionDefaultTest::testGetTitleWithTitleArguments()
  3. 11.x 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 114

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

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

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