mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-28 14:44:17 +01:00
2574 - enable Password expiry
- Extensibility: The UserLocal now provide the fields needed for an extension to be able to properly handle the expiration of the password
This commit is contained in:
@@ -177,5 +177,52 @@ class UserLocalTest extends ItopTestCase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider ProviderPasswordRenewal
|
||||
*
|
||||
*/
|
||||
public function testPasswordRenewal($aUserLocalValues, $oExpectedBefore, $oExpectedAfter)
|
||||
{
|
||||
/** @var UserLocal $oUserLocal */
|
||||
$oUserLocal = \MetaModel::NewObject('UserLocal', $aUserLocalValues);
|
||||
/** @var \ormLinkSet $oProfileSet */
|
||||
$oProfileSet = $oUserLocal->Get('profile_list');
|
||||
|
||||
$oProfileSet->AddItem(
|
||||
\MetaModel::NewObject('URP_UserProfile', array('profileid' => 1))
|
||||
);
|
||||
|
||||
$this->assertEquals($oExpectedBefore, $oUserLocal->Get('password_renewed_date'));
|
||||
|
||||
$oUserLocal->Set('password', 'foo');
|
||||
|
||||
$this->assertEquals($oExpectedAfter, $oUserLocal->Get('password_renewed_date'));
|
||||
}
|
||||
|
||||
public function ProviderPasswordRenewal()
|
||||
{
|
||||
$sNow = date(\AttributeDate::GetInternalFormat());
|
||||
$sYesterday = date(\AttributeDate::GetInternalFormat(), strtotime('-1 day'));
|
||||
$sTomorrow = date(\AttributeDate::GetInternalFormat(), strtotime('+1 day'));
|
||||
|
||||
return array(
|
||||
'nominal case' => array(
|
||||
'aUserLocalValues' => array('login' => 'john'),
|
||||
'oExpectedBefore' => null,
|
||||
'oExpectedAfter' => $sNow,
|
||||
),
|
||||
'date initiated' => array(
|
||||
'aUserLocalValues' => array('login' => 'john', 'password_renewed_date' => $sYesterday),
|
||||
'oExpectedBefore' => $sYesterday,
|
||||
'oExpectedAfter' => $sNow,
|
||||
),
|
||||
'date initiated in the future' => array(
|
||||
'aUserLocalValues' => array('login' => 'john', 'password_renewed_date' => $sTomorrow),
|
||||
'oExpectedBefore' => $sTomorrow,
|
||||
'oExpectedAfter' => $sNow,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user