Merge branch 'MDL-88003-main' of https://github.com/sarjona/moodle
This commit is contained in:
@@ -143,7 +143,9 @@ class course_navigation {
|
||||
// Skip modules that don't have a URL (like labels).
|
||||
!empty($cm->get_url())
|
||||
// Skip modules that are not visible to the user.
|
||||
&& $cm->is_visible_on_course_page();
|
||||
&& $cm->is_visible_on_course_page()
|
||||
// Skip modules that are not displayable.
|
||||
&& modinfo::is_mod_type_visible_on_course($cm->modname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -566,6 +566,41 @@ final class course_navigation_test extends route_testcase {
|
||||
'statuscode' => 404,
|
||||
],
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (student)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm1',
|
||||
'expected' => [
|
||||
'id' => 'cm3', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (teacher)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm1',
|
||||
'expected' => [
|
||||
'id' => 'cm3', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
'role' => 'teacher',
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (editingteacher)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm1',
|
||||
'expected' => [
|
||||
'id' => 'cm3', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
'role' => 'editingteacher',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1032,6 +1067,41 @@ final class course_navigation_test extends route_testcase {
|
||||
'statuscode' => 404,
|
||||
],
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (student)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm3',
|
||||
'expected' => [
|
||||
'id' => 'cm1', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (teacher)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm3',
|
||||
'expected' => [
|
||||
'id' => 'cm1', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
'role' => 'teacher',
|
||||
];
|
||||
yield 'With module not supporting FEATURE_CAN_DISPLAY (editingteacher)' => [
|
||||
'cmsdef' => [
|
||||
['name' => 'cm1'],
|
||||
['name' => 'cm2', 'type' => 'qbank'],
|
||||
['name' => 'cm3'],
|
||||
],
|
||||
'current' => 'cm3',
|
||||
'expected' => [
|
||||
'id' => 'cm1', // The cm2 should be skipped as it does not support FEATURE_CAN_DISPLAY.
|
||||
],
|
||||
'role' => 'editingteacher',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user