Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: statistics_bulk_loader_test  - X-Ref

Tests for question statistics.

test_get_all_places_where_questions_were_attempted()   X-Ref
Test quizzes that contain a specified question.


prepare_quizzes()   X-Ref
Create 2 quizzes.

return: array return 2 quizzes

submit_quiz(object $quiz, array $answers)   X-Ref
Submit quiz answers

param: object $quiz
param: array $answers

generate_attempt_answers(array $correctanswerflags)   X-Ref
Generate attempt answers.

param: array $correctanswerflags array of 1 or 0
return: array

prepare_and_submit_quizzes(array $quiz1attempts, array $quiz2attempts)   X-Ref
Generate quizzes and submit answers.

param: array $quiz1attempts quiz 1 attempts
param: array $quiz2attempts quiz 2 attempts
return: array

extract_item_value(all_calculated_for_qubaid_condition $statistics,int $questionid, string $item)   X-Ref
To use private helper::extract_item_value function.

param: all_calculated_for_qubaid_condition $statistics the batch of statistics.
param: int $questionid a question id.
param: string $item one of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.
return: float|null the required value.

load_quiz_statistics_for_place(context $context)   X-Ref
To use private helper::load_statistics_for_place function (with mod_quiz component).

param: context $context the context to load the statistics for.
return: all_calculated_for_qubaid_condition|null question statistics.

load_question_facility_provider()   X-Ref
Data provider for {@see test_load_question_facility()}.

return: Generator

test_load_question_facility(array $quiz1attempts,array $expectedquiz1facilities,array $quiz2attempts,array $expectedquiz2facilities,array $expectedaveragefacilities)   X-Ref
Test question facility

param: array $quiz1attempts quiz 1 attempts
param: array $expectedquiz1facilities expected quiz 1 facilities
param: array $quiz2attempts quiz 2 attempts
param: array $expectedquiz2facilities  expected quiz 2 facilities
param: array $expectedaveragefacilities expected average facilities

load_question_discriminative_efficiency_provider()   X-Ref
Data provider for {@see test_load_question_discriminative_efficiency()}.

return: Generator

test_load_question_discriminative_efficiency(array $quiz1attempts,array $expectedquiz1discriminativeefficiency,array $quiz2attempts,array $expectedquiz2discriminativeefficiency,array $expectedaveragediscriminativeefficiency)   X-Ref
Test discriminative efficiency

param: array $quiz1attempts quiz 1 attempts
param: array $expectedquiz1discriminativeefficiency expected quiz 1 discriminative efficiency
param: array $quiz2attempts quiz 2 attempts
param: array $expectedquiz2discriminativeefficiency expected quiz 2 discriminative efficiency
param: array $expectedaveragediscriminativeefficiency expected average discriminative efficiency

load_question_discrimination_index_provider()   X-Ref
Data provider for {@see test_load_question_discrimination_index()}.

return: Generator

test_load_question_discrimination_index(array $quiz1attempts,array $expectedquiz1discriminationindex,array $quiz2attempts,array $expectedquiz2discriminationindex,array $expectedaveragediscriminationindex)   X-Ref
Test discrimination index

param: array $quiz1attempts quiz 1 attempts
param: array $expectedquiz1discriminationindex expected quiz 1 discrimination index
param: array $quiz2attempts quiz 2 attempts
param: array $expectedquiz2discriminationindex expected quiz 2 discrimination index
param: array $expectedaveragediscriminationindex expected average discrimination index

test_statistics_disabled()   X-Ref
Test with question statistics disabled