function UserAuthenticationTest::testLookupAccountWithValidUsername

Tests lookupAccount() with a valid username.

File

core/modules/user/tests/src/Unit/UserAuthenticationTest.php, line 91

Class

UserAuthenticationTest
Tests Drupal\user\UserAuthentication.

Namespace

Drupal\Tests\user\Unit

Code

public function testLookupAccountWithValidUsername() : void {
  $this->userStorage
    ->expects($this->once())
    ->method('loadByProperties')
    ->with([
    'name' => $this->username,
  ])
    ->willReturn([
    $this->createStub(User::class),
  ]);
  $this->assertInstanceOf(User::class, $this->userAuth
    ->lookupAccount($this->username));
}

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