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. 10 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 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));
}

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