[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/tests/ -> attempt_walkthrough_from_csv_test.php (summary)

Quiz attempt walk through using data from csv file.

Author: Jamie Pratt <me@jamiep.org>
Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 364 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mod_quiz_attempt_walkthrough_from_csv_testcase:: (10 methods):
  test_walkthrough_from_csv()
  create_quiz()
  create_quiz_simulate_attempts_and_check_results()
  get_full_path_of_csv_file()
  load_csv_data_file()
  explode_dot_separated_keys_to_make_subindexs()
  get_data_for_walkthrough()
  walkthrough_attempts()
  check_attempts_results()
  check_attempt_results()


Class: mod_quiz_attempt_walkthrough_from_csv_testcase  - 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: PHPUnit_Extensions_Database_DataSet_ITable[] $csvdata of data read from csv file "questionsXX.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: PHPUnit_Extensions_Database_DataSet_ITable[] $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: \PHPUnit_Extensions_Database_DataSet_ITable

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 PHPUnit_Extensions_Database_DataSet_ITable 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 PHPUnit_Extensions_Database_DataSet_ITable 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.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1