public function QuizMultichoiceTestCase::testRandomOrder in Quiz 6.x
Same name and namespace in other branches
- 8.6 question_types/quiz_multichoice/tests/src/Functional/QuizMultichoiceTestCase.php \Drupal\Tests\quiz_multichoice\Functional\QuizMultichoiceTestCase::testRandomOrder()
- 8.5 question_types/quiz_multichoice/tests/src/Functional/QuizMultichoiceTestCase.php \Drupal\Tests\quiz_multichoice\Functional\QuizMultichoiceTestCase::testRandomOrder()
Test random order of choices.
@todo I don't know how we would test random questions.
File
- question_types/
quiz_multichoice/ tests/ src/ Functional/ QuizMultichoiceTestCase.php, line 167
Class
- QuizMultichoiceTestCase
- Test multiple choice questions.
Namespace
Drupal\Tests\quiz_multichoice\FunctionalCode
public function testRandomOrder() {
$this
->drupalLogin($this->admin);
$question = $this
->testCreateQuizQuestion([
'choice_random' => 1,
]);
$quiz = $this
->linkQuestionToQuiz($question);
$this
->drupalLogin($this->user);
$this
->drupalGet("quiz/{$quiz->id()}/take");
$this
->drupalPostForm(NULL, [
"question[{$question->id()}][answer][user_answer]" => 1,
], t('Finish'));
}