function UserAuthenticationTest::testAuthenticateWithIncorrectPassword

Tests the authenticate method with an incorrect password.

File

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

Class

UserAuthenticationTest
Tests Drupal\user\UserAuthentication.

Namespace

Drupal\Tests\user\Unit

Code

public function testAuthenticateWithIncorrectPassword() : void {
  $this->userStorage
    ->expects($this->once())
    ->method('loadByProperties')
    ->with([
    'name' => $this->username,
  ])
    ->willReturn([
    $this->createStub(User::class),
  ]);
  $this->passwordService
    ->method('check')
    ->willReturn(FALSE);
  $user = $this->userAuth
    ->lookupAccount($this->username);
  $this->assertFalse($this->userAuth
    ->authenticateAccount($user, $this->password));
}

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