Adding a test to lostpassword.lib.php

skala
Julio Montoya 16 years ago
parent c2413c3f89
commit 9ba935d0f9
  1. 12
      tests/main/auth/lost_password.lib.test.php

@ -17,8 +17,10 @@ class TestLostPassword extends UnitTestCase {
function testget_secret_word(){
global $_configuration;
$add='';
$res = Login::get_secret_word($add);
$this->assertTrue($res);
$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);
}
@ -30,8 +32,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);
$this->assertTrue($userAccountList);
$res = Login::get_user_account_list($user, $reset = false);
$this->assertTrue(is_array($userAccountList));
//var_dump($userAccountList);
}
@ -53,6 +54,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);
@ -61,7 +63,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);

Loading…
Cancel
Save