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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 363 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: attempt_walkthrough_from_csv_test  - X-Ref

Quiz attempt walk through using data from csv file.

test_walkthrough_from_csv($quizsettings, $csvdata)   X-Ref
The only test in this class. This is run multiple times depending on how many sets of files there are in fixtures/
directory.

param: array $quizsettings of settings read from csv file quizzes.csv
param: array $csvdata of data read from csv file "questionsXX.csv", "stepsXX.csv" and "resultsXX.csv".

create_quiz($quizsettings, $qs)   X-Ref
No description

create_quiz_simulate_attempts_and_check_results(array $quizsettings, array $csvdata)   X-Ref
Create quiz, simulate attempts and check results (if resultsXX.csv exists).

param: array $quizsettings Quiz overrides for this quiz.
param: array $csvdata Data loaded from csv files for this test.

get_full_path_of_csv_file(string $setname, string $test)   X-Ref
Get full path of CSV file.

param: string $setname
param: string $test
return: string full path of file.

load_csv_data_file(string $setname, string $test = '')   X-Ref
Load dataset from CSV file "{$setname}{$test}.csv".

param: string $setname
param: string $test
return: array

explode_dot_separated_keys_to_make_subindexs(array $row)   X-Ref
Break down row of csv data into sub arrays, according to column names.

param: array $row from csv file with field names with parts separate by '.'.
return: array the row with each part of the field name following a '.' being a separate sub array's index.

get_data_for_walkthrough()   X-Ref
Data provider method for test_walkthrough_from_csv. Called by PHPUnit.

return: array One array element for each run of the test. Each element contains an array with the params for

walkthrough_attempts(array $steps)   X-Ref

param: array $steps the step data from the csv file.
return: array attempt no as in csv file => the id of the quiz_attempt as stored in the db.

check_attempts_results(array $results, array $attemptids)   X-Ref

param: array $results the results data from the csv file.
param: array $attemptids attempt no as in csv file => the id of the quiz_attempt as stored in the db.

check_attempt_results(array $result, quiz_attempt $attemptobj)   X-Ref
Check that attempt results are as specified in $result.

param: array        $result             row of data read from csv file.
param: quiz_attempt $attemptobj         the attempt object loaded from db.