function test_retrieve_dbMasterSchedule() { // $m = new person("Gabrielle", "Booth", "female", "14 Way St", "Harpswell", "ME", "04079", "", 1112345678, 2071112345, "*****@*****.**", "email", "Mother", 2077758989, "manager", "", "", "active", "programmer", "Steve_2077291234", "yes", "", "", "Mon:morning,Tue:morning", "", "", "02-19-89", "03-14-08", "", ""); $new_MasterScheduleEntry = new MasterScheduleEntry("weekly", "Mon", "odd", "14", "17", 2, "joe2071234567,sue2079876543", "I like pie.", "Night Shift"); // not sure what the id looks like echo 'will test retrieve_dbMasterSchedule </br>'; error_log('testing retrieve'); $result = insert_dbMasterSchedule($new_MasterScheduleEntry); echo 'result is ' . $result; if ($result) { echo "insert_dbMasterSchedule succeeded </br>"; } else { echo "insert_dbMasterSchedule failed</br>"; } $mse = retrieve_dbMasterSchedule($new_MasterScheduleEntry->get_MS_ID()); if ($mse == null) { echo 'Retrieve failed</br>'; } else { checkEquals($mse->get_MS_ID(), "weeklyMon14-17"); checkEquals($mse->get_start_time(), "14"); checkEquals($mse->get_persons(), "joe2071234567,sue2079876543"); checkEquals($mse->get_notes(), "I like pie."); } $res = delete_dbMasterSchedule($new_MasterScheduleEntry->get_MS_ID()); if ($res == null) { echo 'delete failed</br>'; } }
function testRetrieve_persons_by_name() { // $m = new Person("John", "Smith", "Male", "555 Main Street", "Flushing", "NY", "11111", "Queens", PHONE, "2072654046", "*****@*****.**", "volunteer", "applicant","Schedule", "I like helping out", "55555", "03-14-14"); $newProject = new Project(PROJID, "03-12-14", "Main Building", "UnloadDelivery", 10, 13, 15, "", "notes"); echo 'will test retrieve_persons_by_name </br>'; $result = add_person($m); if ($result) { echo "add_person - person was inserted </br>"; } else { echo "add_person - person not inserted </br>"; } echo "test retrieve_persons_by_name</br>"; $personList = retrieve_persons_by_name("John Smith"); if ($personList == null) { echo 'Retrieve failed</br>'; } else { checkEquals($personList[0]->get_id(), ID); checkEquals($personList[0]->get_phone1(), PHONE); checkEquals($personList[0]->get_email(), "*****@*****.**"); } $res = remove_person(ID); if ($res == null) { echo 'Retrieve failed</br>'; } }
function testChange_password() { $m = new Person("John", "Smith", "10-12-87", "Male", "555 Main Street", "Flushing", "NY", "11111", PHONE, "2072654046", "*****@*****.**", "volunteer", " ", "Schedule", "I like helping out", "55555", "03-14-14", "email"); echo 'will test change_password </br>'; $result = add_person($m); echo 'result is ' . $result; if ($result) { echo "add_person person was inserted </br>"; } else { echo "add_person - person was not inserted</br>"; } $result = change_password('John2072445902', 'newpassword'); if ($result) { echo "change_password succeeded </br>"; } else { echo "change_password failed</br>"; } $p = retrieve_person(ID); if ($p == null) { echo 'Retrieve failed</br>'; } else { checkEquals($p->get_password(), "newpassword"); } $res = remove_person(ID); if ($res == null) { echo 'Retrieve failed</br>'; } }