function ContextualLinkDefaultTest::testGetTitle

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitle()
  2. 8.9.x 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 71

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitle() : void {
    $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.