You are here

public function ContextualLinkDefaultTest::testGetTitleWithTitleArguments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest::testGetTitleWithTitleArguments()

@covers ::getTitle

File

core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php, line 101
Contains \Drupal\Tests\Core\Menu\ContextualLinkDefaultTest.

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetTitleWithTitleArguments() {
  $title = 'Example @test';
  $this->pluginDefinition['title'] = new TranslatableMarkup($title, array(
    '@test' => 'value',
  ), [], $this->stringTranslation);
  $this->stringTranslation
    ->expects($this
    ->once())
    ->method('translateString')
    ->with($this->pluginDefinition['title'])
    ->will($this
    ->returnValue('Example value'));
  $this
    ->setupContextualLinkDefault();
  $request = new Request();
  $this
    ->assertEquals('Example value', $this->contextualLinkDefault
    ->getTitle($request));
}