From 9ba935d0f98782534eddbfffae7ebd2d42b01633 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 4 Mar 2010 12:24:31 -0500 Subject: [PATCH] Adding a test to lostpassword.lib.php --- tests/main/auth/lost_password.lib.test.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/main/auth/lost_password.lib.test.php b/tests/main/auth/lost_password.lib.test.php index 1eb9913804..4658bc6e78 100755 --- a/tests/main/auth/lost_password.lib.test.php +++ b/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);