public function QuizFeedbackTest::testNoFeedback in Quiz 8.6
Same name and namespace in other branches
- 8.5 tests/src/Functional/QuizFeedbackTest.php \Drupal\Tests\quiz\Functional\QuizFeedbackTest::testNoFeedback()
- 6.x tests/src/Functional/QuizFeedbackTest.php \Drupal\Tests\quiz\Functional\QuizFeedbackTest::testNoFeedback()
Test no feedback.
File
- tests/
src/ Functional/ QuizFeedbackTest.php, line 128
Class
- QuizFeedbackTest
- Test quiz feedback.
Namespace
Drupal\Tests\quiz\FunctionalCode
public function testNoFeedback() {
$this
->drupalLogin($this->admin);
// Turn off question feedback.
$quiz = $this
->createQuiz(array(
'review_options' => array(),
));
// Add 2 questions with general question feedback.
$question1 = $this
->createQuestion(array(
'type' => 'truefalse',
'truefalse_correct' => 1,
'feedback' => 'Feedback for TF test.',
));
$this
->linkQuestionToQuiz($question1, $quiz);
$question2 = $this
->createQuestion(array(
'type' => 'truefalse',
'truefalse_correct' => 1,
'feedback' => 'Feedback for TF test.',
));
$this
->linkQuestionToQuiz($question2, $quiz);
// Test.
$this
->drupalLogin($this->user);
$this
->drupalGet("quiz/{$quiz->id()}/take");
$this
->drupalPostForm(NULL, array(
"question[{$question1->id()}][answer]" => 1,
), t('Next'));
$this
->drupalPostForm(NULL, array(
"question[{$question2->id()}][answer]" => 1,
), t('Finish'));
$this
->assertText('You have finished this Quiz');
}