示例#1
0
 /**
  * copy attributes of questionGroup recursively to the final state answer-question.
  * @param type $questionnaire
  */
 public function copy($questionGroup)
 {
     $this->id = $questionGroup->id;
     $this->title = $questionGroup->title;
     $this->title_fr = $questionGroup->title_fr;
     $this->parent_group = $questionGroup->parent_group;
     $this->display_rule = $questionGroup->display_rule;
     foreach ($questionGroup->questions as $question) {
         $aq = new AnswerQuestion();
         $aq->copy($question);
         $this->answers[] = $aq;
     }
 }
 /**
  * testing method return array type
  */
 public function testTypeFunction()
 {
     $model = new AnswerQuestion();
     $model->answer = "Hello World !";
     $question = new Question();
     $question->id = "q1";
     $question->label = "Question 1";
     $question->label_fr = $question->label;
     $question->type = "input";
     $question->style = "";
     $question->values = "";
     $question->values_fr = $question->values;
     $question->precomment = "";
     $question->precomment_fr = $question->precomment;
     $model->copy($question);
     $model->setAnswer("Test");
     $this->assertInternalType('array', $model->rules());
     $this->assertInternalType('array', $model->attributeLabels());
     $this->assertInternalType('object', $model);
     $this->assertInternalType('string', $model->getLiteralAnswer());
 }