function UserLegacyTest::testUserFormatName

Tests user_format_name().

@expectedDeprecation user_format_name() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use $account->label() or $account->getDisplayName() instead. See https://www.drupal.org/node/3050794

File

core/modules/user/tests/src/Kernel/UserLegacyTest.php, line 92

Class

UserLegacyTest
Tests legacy user functionality.

Namespace

Drupal\Tests\user\Kernel

Code

public function testUserFormatName() {
    $user = User::create([
        'name' => 'foo',
        'uid' => 10,
    ]);
    $this->assertSame('foo', user_format_name($user));
}

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