class UserToolbarLinkBuilderTest
Tests toolbar's UserToolbarLinkBuilder.
Attributes
#[CoversClass(UserToolbarLinkBuilder::class)]
#[Group('toolbar')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\toolbar\Unit\UserToolbarLinkBuilderTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of UserToolbarLinkBuilderTest
File
-
core/
modules/ toolbar/ tests/ src/ Unit/ UserToolbarLinkBuilderTest.php, line 16
Namespace
Drupal\Tests\toolbar\UnitView source
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());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.