
| Current Path : /var/www/html/rocksensor/web/core/modules/user/tests/src/Unit/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor/web/core/modules/user/tests/src/Unit/ToolbarLinkBuilderTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\user\Unit;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\user\ToolbarLinkBuilder;
/**
* Tests user's ToolbarLinkBuilder.
*
* @coversDefaultClass \Drupal\user\ToolbarLinkBuilder
* @group user
*/
class ToolbarLinkBuilderTest extends UnitTestCase {
/**
* Tests structure of display name render array.
*
* @covers ::renderDisplayName
*/
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());
}
}