public function QuizTakingTestCase::testAnswerSkipped in Quiz 7.5
Test that a user can answer a skipped question.
File
- tests/
QuizTakingTestCase.test, line 344
Class
Code
public function testAnswerSkipped() {
$this
->drupalLogin($this->admin);
$quiz_node = $this
->drupalCreateQuiz(array(
'allow_skipping' => 1,
'allow_jumping' => 1,
));
// 2 questions.
$question_node1 = $this
->drupalCreateNode(array(
'type' => 'truefalse',
'correct_answer' => 1,
));
$this
->linkQuestionToQuiz($question_node1, $quiz_node);
$question_node2 = $this
->drupalCreateNode(array(
'type' => 'truefalse',
'correct_answer' => 1,
));
$this
->linkQuestionToQuiz($question_node2, $quiz_node);
$this
->drupalLogin($this->user);
// Leave a question blank.
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalGet("node/{$quiz_node->nid}/take/1");
$this
->drupalPost(NULL, array(), t('Leave blank'));
// Fill out the blank question.
$this
->drupalGet("node/{$quiz_node->nid}/take/1");
$this
->drupalPost(NULL, array(
"question[{$question_node1->nid}][answer]" => 1,
), t('Next'));
$this
->drupalPost(NULL, array(
"question[{$question_node2->nid}][answer]" => 1,
), t('Finish'));
$this
->clickLink(t('My results'));
$this
->assertText("100");
}