Ejemplo n.º 1
0
 public function test_submits_answers_and_verifies_returned_node_id()
 {
     $answers = array(1, 1, 0, 1, 0, 1, 1, 0);
     $expected_id = 30;
     $id = TracksController::get_track($answers);
     $this->assertTrue($expected_id === $id);
 }
Ejemplo n.º 2
0
 /**
  * @id - integer or numeric string
  *
  * Collects the user submissions and stores in the session
  * returns a redirect to the next step in the survey
  */
 public static function post_question($id)
 {
     // Get the user response or assign to NULL
     $answer = Input::has('answer') ? Input::get('answer') : NULL;
     /*if($id == 0){
     			Session::put('name', $answer);
     			return Redirect::to('question/1');
     		}*/
     if ($id > 0 && $id <= self::$total_questions) {
         Session::put('answers.' . $id, $answer);
         $answers = Session::get('answers');
         $next = TracksController::get_next($answers);
         return Redirect::to($next);
     }
     Log::error('Unable to process submitted question.  ID of: ' . $id . ' is not valid.');
     return Redirect::to('error');
 }