You are here

function MatchingTestCase::testCreateQuizQuestion in Quiz 7.6

Same name and namespace in other branches
  1. 7.5 question_types/matching/matching.test \MatchingTestCase::testCreateQuizQuestion()

Test adding and taking a matching question.

Overrides QuizQuestionTestCase::testCreateQuizQuestion

2 calls to MatchingTestCase::testCreateQuizQuestion()
MatchingTestCase::testChoicePenalty in question_types/matching/matching.test
MatchingTestCase::testTakeQuestion in question_types/matching/matching.test

File

question_types/matching/matching.test, line 33
Unit tests for the matching Module.

Class

MatchingTestCase
Test class for matching questions.

Code

function testCreateQuizQuestion() {

  // Login as our privileged user.
  $this
    ->drupalLogin($this->admin);
  $match = array();
  for ($i = 0; $i <= 2; $i++) {
    $match[$i]['question'] = "MAQ " . ($i + 1);
    $match[$i]['answer'] = "MAA " . ($i + 1);
    $match[$i]['feedback'] = "MAF " . ($i + 1);
  }
  $question_node = $this
    ->drupalCreateNode(array(
    'type' => $this->question_node_type,
    'title' => 'MA 1 title',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'MA 1 body text',
        ),
      ),
    ),
    'match' => $match,
    'choice_penalty' => 0,
  ));
  return $question_node;
}