public function QuizTakingTest::testQuestionCount in Quiz 6.x
Same name and namespace in other branches
- 8.6 tests/src/Functional/QuizTakingTest.php \Drupal\Tests\quiz\Functional\QuizTakingTest::testQuestionCount()
- 8.5 tests/src/Functional/QuizTakingTest.php \Drupal\Tests\quiz\Functional\QuizTakingTest::testQuestionCount()
Verify non gradable questions are excluded from counts.
File
- tests/
src/ Functional/ QuizTakingTest.php, line 328
Class
- QuizTakingTest
- Test quiz taking behavior.
Namespace
Drupal\Tests\quiz\FunctionalCode
public function testQuestionCount() {
$quiz_node = $this
->createQuiz([
'review_options' => [
'question' => [
'score' => 'score',
],
],
]);
$question1 = $this
->createQuestion([
'type' => 'truefalse',
'truefalse_correct' => 1,
]);
$this
->linkQuestionToQuiz($question1, $quiz_node);
$question2 = $this
->createQuestion([
'type' => 'directions',
]);
$this
->linkQuestionToQuiz($question2, $quiz_node);
$question3 = $this
->createQuestion([
'type' => 'truefalse',
'truefalse_correct' => 1,
]);
$this
->linkQuestionToQuiz($question3, $quiz_node);
$question4 = $this
->createQuestion([
'type' => 'truefalse',
'truefalse_correct' => 1,
]);
$this
->linkQuestionToQuiz($question4, $quiz_node);
$question5 = $this
->createQuestion([
'type' => 'truefalse',
'truefalse_correct' => 1,
]);
$this
->linkQuestionToQuiz($question5, $quiz_node);
$this
->drupalLogin($this->user);
$this
->drupalGet("quiz/{$quiz_node->id()}");
// @todo check the pager, this isn't reliable
$this
->assertText("4");
}