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 39 and 400]

This file contains test helper code for testing the upgrade to the new question engine. The actual tests are organised by question type in files like question/type/truefalse/tests/upgradelibnewqe_test.php.

Copyright: 2009 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 141 lines (5 kb)
Included or required:0 times
Referenced: 8 times
Includes or requires: 1 file
 question/engine/upgrade/upgradelib.php

Defines 3 classes

test_question_engine_attempt_upgrader:: (2 methods):
  prevent_timeout()
  __construct()

test_question_engine_upgrade_question_loader:: (4 methods):
  put_question_in_cache()
  load_question()
  put_dataset_in_cache()
  load_dataset()

question_attempt_upgrader_test_base:: (4 methods):
  setUp()
  tearDown()
  clear_html2text_dependencies()
  compare_qas()


Class: test_question_engine_attempt_upgrader  - X-Ref

Subclass of question_engine_attempt_upgrader to help with testing.

prevent_timeout()   X-Ref
No description

__construct($loader, $logger)   X-Ref
No description

Class: test_question_engine_upgrade_question_loader  - X-Ref

Subclass of question_engine_upgrade_question_loader for unit testing.

Class: question_attempt_upgrader_test_base  - X-Ref

Base class for tests that thest the upgrade of one particular attempt and
one question.

setUp()   X-Ref
No description

tearDown()   X-Ref
No description

clear_html2text_dependencies($qa)   X-Ref
Clear text, bringing independence of html2text results

Some tests performing text comparisons of converted text are too much
dependent of the behavior of the html2text library. This function is
aimed to reduce such dependencies that should not affect the results
of these question attempt upgrade tests.

compare_qas($expectedqa, $qa)   X-Ref
Compare two qas, ignoring inessential differences.

param: object $expectedqa the expected qa.
param: object $qa the actual qa.