public function QuizFeedbackTestCase::testFeedbackTimes in Quiz 7.5
Test different feedback times.
File
- tests/
QuizFeedbackTestCase.test, line 252 - Unit tests for the quiz question Module.
Class
- QuizFeedbackTestCase
- Base test class for Quiz questions.
Code
public function testFeedbackTimes() {
$this
->drupalLogin($this->admin);
// Feedback but, only after second attempt (rule).
$quiz_node = $this
->drupalCreateQuiz(array(
'review_options' => array(
'after2attempts' => array(
'solution' => 'solution',
),
),
));
// Set up a Quiz with one question that has a body and a summary.
$question_node1 = $this
->drupalCreateNode(array(
'type' => 'truefalse',
'correct_answer' => 1,
));
$this
->linkQuestionToQuiz($question_node1, $quiz_node);
// Test no feedback.
$this
->drupalLogin($this->user);
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalPost(NULL, array(
"question[{$question_node1->nid}][answer]" => 1,
), t('Finish'));
$this
->assertNoText('Correct answer');
// Take again.
$this
->drupalGet("node/{$quiz_node->nid}/take");
$this
->drupalPost(NULL, array(
"question[{$question_node1->nid}][answer]" => 1,
), t('Finish'));
$this
->assertText('Correct answer');
}