public function ShortAnswerTestCase::testGradeAnswerSensitive in Quiz 7.5
Same name and namespace in other branches
- 7.6 question_types/short_answer/short_answer.test \ShortAnswerTestCase::testGradeAnswerSensitive()
Test case sensitive graded questions.
File
- question_types/
short_answer/ short_answer.test, line 65 - Unit tests for the short_answer Module.
Class
- ShortAnswerTestCase
- Test class for short answer.
Code
public function testGradeAnswerSensitive() {
// Login as our privileged user.
$this
->drupalLogin($this->admin);
$quiz_node = $this
->drupalCreateQuiz(array(
'review_options' => array(
'end' => array(
'score' => 'score',
),
),
));
$question_node = $this
->testCreateQuizQuestion(array(
'correct_answer_evaluation' => ShortAnswerQuestion::ANSWER_MATCH,
'correct_answer' => 'the Zero One Infinity rule',
));
$this
->linkQuestionToQuiz($question_node, $quiz_node);
// Test incorrect.
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalPost(NULL, array(
"question[{$question_node->nid}][answer]" => 'the zero one Infinity rule',
), t('Finish'));
$this
->assertText('Your score: 0%');
// Test correct.
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalPost(NULL, array(
"question[{$question_node->nid}][answer]" => 'the Zero One Infinity rule',
), t('Finish'));
$this
->assertText('Your score: 100%');
}