UserToolbarLinkBuilderTest.php
Namespace
Drupal\Tests\toolbar\UnitFile
-
core/
modules/ toolbar/ tests/ src/ Unit/ UserToolbarLinkBuilderTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\toolbar\Unit;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\toolbar\UserToolbarLinkBuilder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
/**
* Tests toolbar's UserToolbarLinkBuilder.
*/
class UserToolbarLinkBuilderTest extends UnitTestCase {
/**
* Tests structure of display name render array.
*/
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 UserToolbarLinkBuilder($account->reveal());
$expected = [
'#plain_text' => $display_name,
];
$this->assertSame($expected, $toolbar_link_builder->renderDisplayName());
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| UserToolbarLinkBuilderTest | Tests toolbar's UserToolbarLinkBuilder. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.