function ToolbarLinkBuilderTest::testRenderDisplayName

Same name in other branches
  1. 10 core/modules/user/tests/src/Unit/ToolbarLinkBuilderTest.php \Drupal\Tests\user\Unit\ToolbarLinkBuilderTest::testRenderDisplayName()

Tests structure of display name render array.

@covers ::renderDisplayName

File

core/modules/user/tests/src/Unit/ToolbarLinkBuilderTest.php, line 24

Class

ToolbarLinkBuilderTest
Tests user's ToolbarLinkBuilder.

Namespace

Drupal\Tests\user\Unit

Code

public function testRenderDisplayName() : void {
    $account = $this->prophesize(AccountProxyInterface::class);
    $display_name = 'Something suspicious that should be #plain_text, not #markup';
    $account->getDisplayName()
        ->willReturn($display_name);
    $toolbar_link_builder = new ToolbarLinkBuilder($account->reveal());
    $expected = [
        '#plain_text' => $display_name,
    ];
    $this->assertSame($expected, $toolbar_link_builder->renderDisplayName());
}

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