Merge branch 'MDL-86311' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
issueNumber: MDL-86311
|
||||
notes:
|
||||
core:
|
||||
- message: >-
|
||||
The default PHPUnit configuration now enables the following properties,
|
||||
ensuring PHP warnings will cause test failures (restoring pre-PHPUnit
|
||||
version 10 behaviour):
|
||||
|
||||
|
||||
* `failOnDeprecation`
|
||||
|
||||
* `failOnWarning`
|
||||
type: changed
|
||||
@@ -6,6 +6,8 @@
|
||||
processIsolation="false"
|
||||
backupGlobals="false"
|
||||
cacheResult="false"
|
||||
failOnDeprecation="true"
|
||||
failOnWarning="true"
|
||||
stopOnError="false"
|
||||
stopOnFailure="false"
|
||||
stopOnIncomplete="false"
|
||||
|
||||
@@ -293,14 +293,11 @@ class util {
|
||||
public static function normalise_component_path(
|
||||
string $component,
|
||||
): string {
|
||||
if ($component === 'core') {
|
||||
return $component;
|
||||
}
|
||||
[$type, $subsystem] = \core\component::normalize_component($component);
|
||||
if ($type === 'core') {
|
||||
if ($type === 'core' && $subsystem !== null) {
|
||||
return str_replace('core_', '', $subsystem);
|
||||
}
|
||||
|
||||
return $component ?? '';
|
||||
return $component;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,6 +447,7 @@ final class question_type_test extends \advanced_testcase {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
/** @var \core_question_generator $generator */
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$cat = $generator->create_question_category([]);
|
||||
$question = $generator->create_question('multianswer', 'twosubq', ['category' => $cat->id]);
|
||||
@@ -465,6 +466,7 @@ final class question_type_test extends \advanced_testcase {
|
||||
$editedquestion = test_question_maker::get_question_data('multianswer', 'twosubq');
|
||||
$editedquestion->id = $question->id;
|
||||
$editedquestion->category = $cat->id;
|
||||
$editedquestion->context = \context_helper::instance_by_id($cat->contextid);
|
||||
$editedsubq1 = test_question_maker::get_question_form_data('multichoice', 'one_of_four');
|
||||
$editedsubq1->id = $originalsubq1->id;
|
||||
$editedsubq1->qtype = 'multichoice';
|
||||
|
||||
@@ -48,7 +48,7 @@ final class restore_test extends \advanced_testcase {
|
||||
$cat = $questiongenerator->create_question_category(['contextid' => $context->id]);
|
||||
|
||||
// Create a quiz containing a multichoice question from the qbank.
|
||||
$quiz = $this->getDataGenerator()->get_plugin_generator('quiz')->create_instance(['course' => $course1->id]);
|
||||
$quiz = $this->getDataGenerator()->get_plugin_generator('mod_quiz')->create_instance(['course' => $course1->id]);
|
||||
$question = $questiongenerator->create_question('multichoice', 'one_of_four', ['category' => $cat->id]);
|
||||
quiz_add_quiz_question($question->id, $quiz);
|
||||
|
||||
@@ -72,6 +72,13 @@ final class restore_test extends \advanced_testcase {
|
||||
$rc->execute_plan();
|
||||
$rc->destroy();
|
||||
|
||||
// Executing the precheck and plan will each emit debugging related to missing options.
|
||||
$this->assertDebuggingCalledCount(
|
||||
2,
|
||||
array_fill(0, 2, "Question ID {$question->id} was missing an options record. Using default."),
|
||||
array_fill(0, 2, DEBUG_DEVELOPER),
|
||||
);
|
||||
|
||||
// Both quizzes should refer to the same original question.
|
||||
$quizzes = get_fast_modinfo($course1->id)->get_instances_of('quiz');
|
||||
$this->assertCount(2, $quizzes);
|
||||
|
||||
@@ -48,7 +48,7 @@ final class restore_test extends \advanced_testcase {
|
||||
$cat = $questiongenerator->create_question_category(['contextid' => $context->id]);
|
||||
|
||||
// Create a quiz containing a multichoice question from the qbank.
|
||||
$quiz = $this->getDataGenerator()->get_plugin_generator('quiz')->create_instance(['course' => $course1->id]);
|
||||
$quiz = $this->getDataGenerator()->get_plugin_generator('mod_quiz')->create_instance(['course' => $course1->id]);
|
||||
$question = $questiongenerator->create_question('numerical', 'pi', ['category' => $cat->id]);
|
||||
quiz_add_quiz_question($question->id, $quiz);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user