You are here

public function ShortAnswerTestCase::testCreateQuizQuestion in Quiz 7.5

Same name and namespace in other branches
  1. 7.6 question_types/short_answer/short_answer.test \ShortAnswerTestCase::testCreateQuizQuestion()

Test adding and taking a truefalse question.

Overrides QuizQuestionTestCase::testCreateQuizQuestion

5 calls to ShortAnswerTestCase::testCreateQuizQuestion()
ShortAnswerTestCase::testEditQuestionResponse in question_types/short_answer/short_answer.test
Test that the question response can be edited.
ShortAnswerTestCase::testGradeAnswerInsensitive in question_types/short_answer/short_answer.test
Test case insensitive graded questions.
ShortAnswerTestCase::testGradeAnswerManualFeedback in question_types/short_answer/short_answer.test
Test manually graded questions.
ShortAnswerTestCase::testGradeAnswerRegex in question_types/short_answer/short_answer.test
Test regex graded questions.
ShortAnswerTestCase::testGradeAnswerSensitive in question_types/short_answer/short_answer.test
Test case sensitive graded questions.

File

question_types/short_answer/short_answer.test, line 198
Unit tests for the short_answer Module.

Class

ShortAnswerTestCase
Test class for short answer.

Code

public function testCreateQuizQuestion($settings = array()) {
  if (!$settings) {
    $settings = array(
      'correct_answer_evaluation' => ShortAnswerQuestion::ANSWER_INSENSITIVE_MATCH,
      'correct_answer' => 'SA 1 correct answer.',
    );
  }

  // Login as our privileged user.
  $this
    ->drupalLogin($this->admin);
  $question_node = $this
    ->drupalCreateNode(array(
    'type' => $this->question_node_type,
    'title' => 'SA 1 title',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'SA 1 body text.',
        ),
      ),
    ),
  ) + $settings);
  return $question_node;
}