Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

File Size: 365 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($quizsettings, $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($setname, $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($setname, $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($steps)   X-Ref

param: $steps array 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($results, $attemptids)   X-Ref

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

check_attempt_results($result, $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.