/**
  * Test savingForm
  * Test so a proper form is saved, with correct data.
  * Also test if it is possible to enter incorrect data that might ruin something.
  * @author Fredrik Andersson
  * @small
  * @test
  */
 public function formFunctions()
 {
     // Create new user class
     $a = new PP();
     // Check if the object was created
     $this->assertNotNull($a);
     // Adding some variables into the form class PP
     $a->student1 = "StudentName";
     $this->assertEquals("StudentName", $a->student1);
     //Test of the function test_num($data)
     $this->assertEquals(1, test_num(1));
     $this->assertEquals("-", test_num("-"));
     $this->assertEquals("-", test_num(10));
     //Test of the function test_input($data)
     $this->assertEquals("123", test_input("  123  "));
     //trim() removes spaces before the first char and after the last one.
     $this->assertEquals("123'hihi\ttab", test_input("123\\'hi\\hi\ttab"));
     //stripslashes() removes all slashes exept proper slashes like \t and \n etc.
     $this->assertEquals("&amp; &quot; &lt; &gt;", test_input("& \" < >"));
     //htmlspecialchars() changes some special characters to code that html can handle.
     //Test of the function is_empty($data)
     $this->assertEquals(false, is_empty(array('apple', 'banana ', ' cranberry ')));
     $this->assertEquals(false, is_empty(array('', '', '')));
     $temp[10] = "something";
     $this->assertEquals(false, is_empty($temp));
     //Test of the function input_length()
     $string128 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
     $string129 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab";
     $this->assertEquals($string128, input_length($string129));
     //Test of the function length_one()
     $this->assertEquals("1", length_one("12345"));
 }
    $data->content1 = length_one(test_input(test_num($_POST["content1"])));
    $data->content2 = length_one(test_input(test_num($_POST["content2"])));
    $data->content3 = length_one(test_input(test_num($_POST["content3"])));
    $data->s2 = length_three(test_input(test_num($_POST["s2"])));
    $data->contribution1 = length_one(test_input(test_num($_POST["contribution1"])));
    $data->contribution2 = length_one(test_input(test_num($_POST["contribution2"])));
    $data->contribution3 = length_one(test_input(test_num($_POST["contribution3"])));
    $data->s3 = length_three(test_input(test_num($_POST["s3"])));
    $data->presentation1 = length_one(test_input(test_num($_POST["presentation1"])));
    $data->presentation2 = length_one(test_input(test_num($_POST["presentation2"])));
    $data->presentation3 = length_one(test_input(test_num($_POST["presentation3"])));
    $data->presentation4 = length_one(test_input(test_num($_POST["presentation4"])));
    $data->presentation5 = length_one(test_input(test_num($_POST["presentation5"])));
    $data->s4 = length_three(test_input(test_num($_POST["s4"])));
    $data->s5 = length_three(test_input(test_num($_POST["s5"])));
    $data->s6 = length_one(test_input(test_grade($_POST["s6"])));
    $data->impression = input_length(test_input($_POST["impression"]));
    $data->rname = input_length(test_input($_POST["rname"]));
    $data->date = length_date(test_input($_POST["date"]));
    $data->feedback = input_length(test_input($_POST["feedback"]));
    // Create the review
    $review = Review::createReview($data);
    // Add it to the submission
    $submission->addReview($review->id);
    echo '<h3>Success!</h3><a href="?"><button class="btn btn-success">Go back</button></a>';
} else {
    $data;
    $latestID = $submission->getLatestReview($user->id);
    // If user already has a review
    if ($latestID > -1) {
        $review = new Review($latestID);