You are here

public function LongAnswerTestCase::testEditQuestionResponse in Quiz 7.5

Test that the question response can be edited.

File

question_types/long_answer/long_answer.test, line 184
Unit tests for the long_answer Module.

Class

LongAnswerTestCase
Test class for long answer.

Code

public function testEditQuestionResponse() {
  $this
    ->drupalLogin($this->admin);

  // 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);
  $this
    ->drupalGet("node/{$quiz_node->nid}/take");
  $this
    ->drupalGet("node/{$quiz_node->nid}/take/1");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node->nid}][answer]" => 'um some rule, I forget',
  ), t('Next'));
  $this
    ->drupalGet("node/{$quiz_node->nid}/take/1");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node->nid}][answer]" => 'um some rule, I forget',
  ), t('Next'));
}