You are here

public function ContextualLinkDefaultTest::testGetTitle in Drupal 8

Same name and namespace in other branches
  1. 9 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 66

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'])
    ->will($this
    ->returnValue('Example translated'));
  $this
    ->setupContextualLinkDefault();
  $this
    ->assertEquals('Example translated', $this->contextualLinkDefault
    ->getTitle());
}