You are here

public function QuizResultTestCase::testBrokenResults in Quiz 7.5

Test that deleting a question from a Quiz doesn't result in a fatal error.

File

tests/QuizResultTestCase.test, line 720

Class

QuizResultTestCase

Code

public function testBrokenResults() {
  $this
    ->drupalLogin($this->admin);
  $question_node1 = $this
    ->drupalCreateNode(array(
    'type' => 'truefalse',
    'correct_answer' => 1,
  ));
  $quiz_node = $this
    ->linkQuestionToQuiz($question_node1);

  // Submit an answer.
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet("node/{$quiz_node->nid}/take");
  $this
    ->drupalPost(NULL, array(
    "question[{$question_node1->nid}][answer]" => 1,
  ), t('Finish'));

  // Delete the question.
  node_delete($question_node1->nid);

  // And there should not be a fatal error.
  $this
    ->drupalGet("node/{$quiz_node->nid}/quiz-results/1");
  $this
    ->assertResponse(200, 'Saw the results page.');
}