|
|
|
|
@ -4,6 +4,9 @@ require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); |
|
|
|
|
|
|
|
|
|
class TestLostPassword extends UnitTestCase { |
|
|
|
|
|
|
|
|
|
public function __construct(){ |
|
|
|
|
$this->UnitTestCase('Lost password library - main/auth/lost_password.lib.test.php'); |
|
|
|
|
} |
|
|
|
|
/* function commented in platform code |
|
|
|
|
function testget_email_headers(){ |
|
|
|
|
global $charset; |
|
|
|
|
@ -17,10 +20,10 @@ class TestLostPassword extends UnitTestCase { |
|
|
|
|
function testget_secret_word(){ |
|
|
|
|
global $_configuration; |
|
|
|
|
$add=''; |
|
|
|
|
$res = Login::get_secret_word($add); |
|
|
|
|
$res = Login::get_secret_word($add); |
|
|
|
|
// Expects an string of 32 chars |
|
|
|
|
$this->assertEqual(strlen($res),32); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
//var_dump($res); |
|
|
|
|
} |
|
|
|
|
@ -32,7 +35,7 @@ class TestLostPassword extends UnitTestCase { |
|
|
|
|
$secretword = Login::get_secret_word($thisUser["email"]); |
|
|
|
|
$reset_link = get_lang('Pass')." : $thisUser[password]"; |
|
|
|
|
$userAccountList[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$thisUser["loginName"]."\n".get_lang('ResetLink').' : '.$reset_link.''; |
|
|
|
|
$res = Login::get_user_account_list($user, $reset = false); |
|
|
|
|
$res = Login::get_user_account_list($user, $reset = false); |
|
|
|
|
$this->assertTrue(is_array($userAccountList)); |
|
|
|
|
//var_dump($userAccountList); |
|
|
|
|
} |
|
|
|
|
@ -54,7 +57,7 @@ class TestLostPassword extends UnitTestCase { |
|
|
|
|
$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname'); |
|
|
|
|
$email_admin = api_get_setting('emailAdministrator'); |
|
|
|
|
$res=Login::handle_encrypted_password($user); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!is_array($res))$this->assertTrue(is_null($res)); |
|
|
|
|
ob_end_clean(); |
|
|
|
|
//var_dump($res); |
|
|
|
|
@ -63,7 +66,7 @@ class TestLostPassword extends UnitTestCase { |
|
|
|
|
function testreset_password(){ |
|
|
|
|
$secret='1234567891011'; |
|
|
|
|
$id=5; |
|
|
|
|
$res=Login::reset_password($secret, $id); |
|
|
|
|
$res=Login::reset_password($secret, $id); |
|
|
|
|
$this->assertTrue($res); |
|
|
|
|
$this->assertTrue(is_string($res)); |
|
|
|
|
//var_dump($res); |
|
|
|
|
|