本文整理汇总了PHP中UserIdentity::resetPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserIdentity::resetPassword方法的具体用法?PHP UserIdentity::resetPassword怎么用?PHP UserIdentity::resetPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserIdentity
的用法示例。
在下文中一共展示了UserIdentity::resetPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPasswordReset
public function testPasswordReset()
{
$fakeIdentity = new UserIdentity(null, null);
$fakeIdentity->setId(999);
$this->assertFalse($fakeIdentity->resetPassword('xx'));
$identity = UserIdentity::find(array('username' => 'cat'));
$this->assertEquals(4, $identity->getId());
$this->assertFalse($identity->authenticate());
$dateBefore = date('Y-m-d H:i:s');
$this->assertTrue($identity->resetPassword('Test1234'));
$dateAfter = date('Y-m-d H:i:s');
$identity->password = 'Test1234';
$this->assertTrue($identity->authenticate());
$this->assertGreaterThanOrEqual($dateBefore, $identity->getPasswordDate());
$this->assertLessThanOrEqual($dateAfter, $identity->getPasswordDate());
$this->assertGreaterThanOrEqual($dateBefore, $identity->getPasswordDate('Test1234'));
$this->assertLessThanOrEqual($dateAfter, $identity->getPasswordDate('Test1234'));
$this->assertNull($identity->getPasswordDate('xx'));
}