function ContextualLinkDefaultTest::testGetTitle

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitle()
  2. 10 core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitle()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitle()

@covers ::getTitle

File

core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php, line 69

Class

ContextualLinkDefaultTest
@group Menu @coversDefaultClass \Drupal\Core\Menu\ContextualLinkDefault

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitle() {
    $title = 'Example';
    $this->pluginDefinition['title'] = new TranslatableMarkup($title, [], [], $this->stringTranslation);
    $this->stringTranslation
        ->expects($this->once())
        ->method('translateString')
        ->with($this->pluginDefinition['title'])
        ->willReturn('Example translated');
    $this->setupContextualLinkDefault();
    $this->assertEquals('Example translated', $this->contextualLinkDefault
        ->getTitle());
}

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