public function test_resetPassword($email, $secretAns, $newpassword, $ans, $note) { require_once '../Controller/StudentController.php'; $studentController = new StudentController(); $result = $studentController->resetPassword($email, $secretAns, $newpassword); $result = trim($result); //$result = str_replace(PHP_EOL,null,$result); $ans = trim($ans); //$ans = str_replace(PHP_EOL,null,$ans); /* print_r($ans); echo "\n"; print_r($result); exit();*/ if (strcmp($result, $ans) == 0) { $ans = "PASSED"; } else { $ans = "FAILED"; } /* if($ans == $result) $ans = "PASSED"; else $ans = "FAILED"; */ return $test = "<br />\n\t\t\t\t\tTesting resetPassword()<br /><b>note:</b> {$note}\n\t\t\t\t\t<br />\n\t\t\t\t\tWith: " . $email . ", " . $secretAns . ", " . $newpassword . "\n\t\t\t\t\t<br />\n\t\t\t\t\tTest: " . $ans . "<br />"; }
/** * @covers a */ function test__StudentControllerresetPasswordInvalidEamil() { $result = "FAILURE TO LOOK UP ENTRY IN THE DATABASE"; $email = 'adfgadfg'; $secretAnswer = ''; $newpassword = ''; $s = new StudentController(); return $this->assertEquals($s->resetPassword($email, $secretAns, $newpassword), $result); }
<?php /*created by Javier Andrial*/ ini_set('display_errors', 1); error_reporting(~0); require 'Controller/StudentController.php'; $studentController = new StudentController(); session_start(); if (isset($_POST['textbox_newPass']) || isset($_POST['textbox_secretAns'])) { if (isset($_POST['textbox_newPass']) && isset($_POST['textbox_secretAns'])) { $email = $_SESSION['forgotPassword']; $found = $studentController->resetPassword($email, $_POST['textbox_secretAns'], $_POST['textbox_newPass']); } else { $found = "You must fill both Secret Answer and New Password feilds before proceeding"; } if (isset($_SESSION['forgotPassword'])) { unset($_SESSION['forgotPassword']); } } else { if (isset($_POST['textbox_txt'])) { $found = $studentController->findStudentAccount($_POST['textbox_txt']); } else { $found = $studentController->CreateForgotPage(); } } $title = "Forgot Password"; $content = $found; //include 'Styles/ManageTemplate.php'; include 'template.php'; ?>