コード例 #1
0
/**
 *function to receive information from the javascript page
 */
function assignTask()
{
    include "assignTask.php";
    $theTask = new AssignTask();
    $id = $_GET['nId'];
    $name = $_GET['name'];
    $tId = $_GET['taskId'];
    $tName = $_GET['taskName'];
    $desc = $_GET['taskDesc'];
    $sDate = $_GET['sDate'];
    $eDate = $_GET['eDate'];
    /**
     *executes the assign method  which inserts to the database
     *@param $id - this is the id of the nurse who takes the task
     *@param $name - this is the name of the nurse who takes the task
     *@param $tId - the id of the task being assigned to the nurse
     *@param $tName -the name of the task being allocated
     *@param $desc - the description of the task being allocated
     *@param $sDate - the date the nurse is supposed to start the task
     *@param $eDate - the date the nurse is supposed to end the task
     *passing the variables to assign task to the nurse
     */
    if (!$theTask->assigTask($id, $name, $tId, $tName, $desc, $sDate, $eDate)) {
        echo '{"result": 0, "message": "could not assign task"}';
    } else {
        echo '{"result": 1, "message": "Task  was assigned  sucessfully"}';
    }
    return;
}
コード例 #2
0
 public function testEmptyInputs()
 {
     // Arrange
     $a = new AssignTask();
     $nurseId = '4';
     $nurseName = "RURU";
     $taskId = '4';
     $taskName = "Visit the sick people in the enshipai village";
     $taskDesc = "there are many sick people";
     $sDate = "2016-01-01";
     $eDate = "2016-01-11";
     // Assert
     $this->assertEquals(1, $a->assigTask($nurseId, $nurseName, $taskId, $taskName, $taskDesc, $sDate, $eDate));
 }