public function QuizTestBase::createQuiz in Quiz 8.6
Same name and namespace in other branches
- 8.5 tests/src/Functional/QuizTestBase.php \Drupal\Tests\quiz\Functional\QuizTestBase::createQuiz()
- 6.x tests/src/Functional/QuizTestBase.php \Drupal\Tests\quiz\Functional\QuizTestBase::createQuiz()
Create a quiz with all end feedback settings enabled by default.
Return value
41 calls to QuizTestBase::createQuiz()
- MatchingTestCase::testChoicePenalty in question_types/
quiz_matching/ tests/ src/ Functional/ MatchingTestCase.php - Test if the penalty system for guessing wrong work.
- MatchingTestCase::testTakeQuestion in question_types/
quiz_matching/ tests/ src/ Functional/ MatchingTestCase.php - Test using a matching question inside a quiz.
- QuizAccessTest::testQuizOwnerResultEdit in tests/
src/ Functional/ QuizAccessTest.php - Test quiz authors being able to score results for own quiz.
- QuizBuildOnLastTest::testBuildOnLastAttempt in tests/
src/ Functional/ QuizBuildOnLastTest.php - Test the build on last attempt functionality.
- QuizCategorizedRandomTest::testCategorizedRandomQuestions in tests/
src/ Functional/ QuizCategorizedRandomTest.php - Test pulling questions from categories.
File
- tests/
src/ Functional/ QuizTestBase.php, line 86
Class
- QuizTestBase
- Base test class for Quiz questions.
Namespace
Drupal\Tests\quiz\FunctionalCode
public function createQuiz($settings = array()) {
$settings += array(
'title' => 'Quiz',
'body' => 'Quiz description',
'type' => 'quiz',
'result_type' => 'quiz_result',
'review_options' => array(
'end' => array_combine(array_keys(quiz_get_feedback_options()), array_keys(quiz_get_feedback_options())),
),
);
$quiz = Quiz::create($settings);
$quiz
->save();
return $quiz;
}