function UserEntityTest::testChainExistingPasswordMethod

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserEntityTest.php \Drupal\Tests\user\Kernel\UserEntityTest::testChainExistingPasswordMethod()
  2. 10 core/modules/user/tests/src/Kernel/UserEntityTest.php \Drupal\Tests\user\Kernel\UserEntityTest::testChainExistingPasswordMethod()

Tests that ::existingPassword can be used for chaining.

File

core/modules/user/tests/src/Kernel/UserEntityTest.php, line 99

Class

UserEntityTest
Tests the user entity class.

Namespace

Drupal\Tests\user\Kernel

Code

public function testChainExistingPasswordMethod() : void {
    
    /** @var \Drupal\user\Entity\User $user */
    $user = User::create([
        'name' => $this->randomMachineName(),
    ]);
    $user = $user->setExistingPassword('existing_pass');
    $this->assertInstanceOf(User::class, $user);
}

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