Issue #3137119 by munish.kumar, johnwebdev, Jaypan, jungle, xjm, catch: User::setExistingPassword() does not return $this for chaining
parent
436f58744e
commit
51e7a08352
|
@ -398,6 +398,7 @@ class User extends ContentEntityBase implements UserInterface {
|
||||||
*/
|
*/
|
||||||
public function setExistingPassword($password) {
|
public function setExistingPassword($password) {
|
||||||
$this->get('pass')->existing = $password;
|
$this->get('pass')->existing = $password;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,4 +91,16 @@ class UserEntityTest extends KernelTestBase {
|
||||||
$this->assertFalse((bool) $violations->count());
|
$this->assertFalse((bool) $violations->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that ::existingPassword can be used for chaining.
|
||||||
|
*/
|
||||||
|
public function testChainExistingPasswordMethod() {
|
||||||
|
/** @var \Drupal\user\Entity\User $user */
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $this->randomMachineName(),
|
||||||
|
]);
|
||||||
|
$user = $user->setExistingPassword('existing_pass');
|
||||||
|
$this->assertInstanceOf(User::class, $user);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue