public function testSetPassword() { $role = new core_kernel_classes_Resource(INSTANCE_ROLE_GENERIS); $user = $this->service->addUser('passwordUser', 'passwordUser', $role); $this->assertTrue($user->exists()); $this->assertTrue($this->service->isPasswordValid('passwordUser', $user)); $this->assertFalse($this->service->isPasswordValid('password', $user)); $this->service->setPassword($user, 'password'); $this->assertTrue($this->service->isPasswordValid('password', $user)); $this->service->removeUser($user); $this->assertFalse($user->exists()); }
/** * Indicates if a given user has a given password. * * @param string password The password to check. * @param core_kernel_classes_Resource user The user you want to check the password. * @return boolean */ public function isPasswordValid($password, core_kernel_classes_Resource $user) { return $this->generisUserService->isPasswordValid($password, $user); }