Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

File Size: 363 lines (15 kb)
Included or required:0 times
Referenced: 1 time
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.

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

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

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

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

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

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

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

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.