function UserAuthenticationTest::testLookupAccountWithInvalidUsername

Tests lookupAccount() with an invalid username.

File

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

Class

UserAuthenticationTest
Tests Drupal\user\UserAuthentication.

Namespace

Drupal\Tests\user\Unit

Code

public function testLookupAccountWithInvalidUsername() : void {
  $this->userStorage
    ->expects($this->once())
    ->method('loadByProperties')
    ->with([
    'name' => 'invalidUser',
  ])
    ->willReturn([]);
  $this->assertFalse($this->userAuth
    ->lookupAccount('invalidUser'));
}

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