You are here

public function MultichoiceTestCase::testAnswerMultiRestore in Quiz 7.5

Test restoring a multiple choice answer.

File

question_types/multichoice/multichoice.test, line 138
Test suite for choice Questions type module.

Class

MultichoiceTestCase
Test class for multichoice questions.

Code

public function testAnswerMultiRestore() {

  // Checkboxes.
  $this
    ->drupalLogin($this->admin);
  $question_node = $this
    ->testCreateQuizQuestion(array(
    'choice_multi' => 1,
  ));
  $question_node2 = $this
    ->testCreateQuizQuestion(array(
    'choice_multi' => 1,
  ));
  $quiz_node = $this
    ->linkQuestionToQuiz($question_node);
  $this
    ->linkQuestionToQuiz($question_node2, $quiz_node);
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet("node/{$quiz_node->nid}/take");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node->nid}][answer][user_answer][1]" => 1,
  ), t('Next'));
  $this
    ->drupalGet("node/{$quiz_node->nid}/take/1");
  $this
    ->assertFieldChecked('edit-question-1-answer-user-answer-1');
}