You are here

public function QuizTestCase::linkQuestionToQuiz in Quiz 7.6

Same name and namespace in other branches
  1. 7.5 tests/QuizTestCase.test \QuizTestCase::linkQuestionToQuiz()

Link a question to a new or provided quiz.

40 calls to QuizTestCase::linkQuestionToQuiz()
LongAnswerTestCase::testGradeAnswerManualFeedback in question_types/long_answer/long_answer.test
Test manually graded questions. Also test feedback here instead of its own test case.
MatchingTestCase::testChoicePenalty in question_types/matching/matching.test
MatchingTestCase::testTakeQuestion in question_types/matching/matching.test
MultichoiceTestCase::testMultipleAnswers in question_types/multichoice/multichoice.test
Test multiple answers.
MultichoiceTestCase::testQuestionFeedback in question_types/multichoice/multichoice.test

... See full list

File

tests/QuizTestCase.test, line 106
Unit tests for the quiz question Module.

Class

QuizTestCase
Base test class for Quiz questions.

Code

public function linkQuestionToQuiz($question_node, $quiz_node = NULL) {
  if (!$quiz_node) {

    // Create a new quiz with defaults.
    $quiz_node = $this
      ->drupalCreateQuiz();
  }
  _quiz_question_get_instance($question_node)
    ->saveRelationships($quiz_node->nid, $quiz_node->vid);
  return $quiz_node;
}