function MatchingTestCase::testChoicePenalty in Quiz 7.6
Same name and namespace in other branches
- 7.5 question_types/matching/matching.test \MatchingTestCase::testChoicePenalty()
File
- question_types/
matching/ matching.test, line 113 - Unit tests for the matching Module.
Class
- MatchingTestCase
- Test class for matching questions.
Code
function testChoicePenalty() {
$quiz_node = $this
->drupalCreateQuiz(array(
'review_options' => array(
'end' => drupal_map_assoc(array(
'answer_feedback',
'score',
)),
),
));
$question_node = $this
->testCreateQuizQuestion();
$question_node->choice_penalty = 1;
node_save($question_node);
// Link the question.
$this
->linkQuestionToQuiz($question_node, $quiz_node);
// Login as non-admin.
$this
->drupalLogin($this->user);
// Test penalty
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalPost(NULL, array(
"question[{$question_node->nid}][answer][4]" => 4,
"question[{$question_node->nid}][answer][5]" => 5,
"question[{$question_node->nid}][answer][6]" => 4,
), t('Finish'));
$this
->assertText('You got 1 of 3 possible points.');
}