You are here

public function ScaleTestCase::testEditQuestionResponse in Quiz 7.5

Same name and namespace in other branches
  1. 8.6 question_types/quiz_scale/quiz_scale.test \ScaleTestCase::testEditQuestionResponse()
  2. 8.5 question_types/quiz_scale/quiz_scale.test \ScaleTestCase::testEditQuestionResponse()

Test that the question response can be edited.

File

question_types/scale/scale.test, line 96
Test suite for scale question type module.

Class

ScaleTestCase
Test class for scale questions.

Code

public function testEditQuestionResponse() {

  // Create & link a question.
  $question_node = $this
    ->testCreateQuizQuestion();
  $quiz_node = $this
    ->linkQuestionToQuiz($question_node);
  $question_node2 = $this
    ->testCreateQuizQuestion();
  $this
    ->linkQuestionToQuiz($question_node2, $quiz_node);

  // Login as non-admin.
  $this
    ->drupalLogin($this->user);

  // Take the quiz.
  $this
    ->drupalGet("node/{$quiz_node->nid}/take");

  // Test editing a question.
  $this
    ->drupalGet("node/{$quiz_node->nid}/take");
  $this
    ->drupalGet("node/{$quiz_node->nid}/take/1");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node->nid}][answer]" => 24,
  ), t('Next'));
  $this
    ->drupalGet("node/{$quiz_node->nid}/take/1");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node->nid}][answer]" => 24,
  ), t('Next'));
}